service2.js: Unify equal/same comparisons
This commit is contained in:
parent
5f83dfa4ba
commit
0e7e324694
12
service2.js
12
service2.js
@ -382,7 +382,7 @@ class BesDOMService extends BesService {
|
||||
// Block elements are grammar-checked independently.
|
||||
this.onProofing()
|
||||
let result = this.getProofing(node)
|
||||
if (result != null) {
|
||||
if (result) {
|
||||
this.onProofingProgress(result.matches.length)
|
||||
return [{ text: `<${node.tagName}/>`, node: node, markup: true }]
|
||||
}
|
||||
@ -663,14 +663,14 @@ class BesDOMService extends BesService {
|
||||
// Walk parent nodes from start to common ancestor.
|
||||
for (node = start.parentNode; node; node = node.parentNode) {
|
||||
nodes.push(node)
|
||||
if (node == commonAncestor) break
|
||||
if (node === commonAncestor) break
|
||||
}
|
||||
nodes.reverse()
|
||||
|
||||
// Walk children and siblings from start until end node is found.
|
||||
for (node = start; node; node = BesDOMService.getNextNode(node)) {
|
||||
nodes.push(node)
|
||||
if (node == end) break
|
||||
if (node === end) break
|
||||
}
|
||||
|
||||
return nodes
|
||||
@ -904,7 +904,7 @@ class BesPlainTextService extends BesService {
|
||||
) {
|
||||
this.reEOP.lastIndex = start
|
||||
let match = this.reEOP.exec(text)
|
||||
if (match !== null) {
|
||||
if (match) {
|
||||
eop = match.index
|
||||
end = this.reEOP.lastIndex
|
||||
} else {
|
||||
@ -924,7 +924,7 @@ class BesPlainTextService extends BesService {
|
||||
|
||||
this.onProofing()
|
||||
let result = this.getProofing(paragraphRange)
|
||||
if (result != null) {
|
||||
if (result) {
|
||||
this.onProofingProgress(result.matches.length)
|
||||
continue
|
||||
}
|
||||
@ -1550,7 +1550,7 @@ window.addEventListener('load', () => {
|
||||
if (hostElement.tagName === 'TEXTAREA') {
|
||||
BesTAService.register(hostElement)
|
||||
} else if (
|
||||
hostElement.getAttribute('contenteditable').toLowerCase() ==
|
||||
hostElement.getAttribute('contenteditable').toLowerCase() ===
|
||||
'plaintext-only'
|
||||
) {
|
||||
BesPlainTextService.register(hostElement)
|
||||
|
Loading…
x
Reference in New Issue
Block a user