mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-20 22:21:20 +02:00
slate-html-serializer: consistent element.value lookups (#1503)
* consistent element.value lookups * fix JSDOC / lint * remove getValue util in favor of element.nodeValue lookup
This commit is contained in:
@@ -37,13 +37,13 @@ const TEXT_RULE = {
|
||||
}
|
||||
|
||||
if (el.nodeName == '#text') {
|
||||
if (el.value && el.value.match(/<!--.*?-->/)) return
|
||||
if (el.nodeValue && el.nodeValue.match(/<!--.*?-->/)) return
|
||||
|
||||
return {
|
||||
kind: 'text',
|
||||
leaves: [{
|
||||
kind: 'leaf',
|
||||
text: el.value || el.nodeValue
|
||||
text: el.nodeValue
|
||||
}]
|
||||
}
|
||||
}
|
||||
@@ -395,7 +395,7 @@ class Html {
|
||||
*/
|
||||
|
||||
cruftNewline = (element) => {
|
||||
return !(element.nodeName === '#text' && element.value == '\n')
|
||||
return !(element.nodeName === '#text' && element.nodeValue == '\n')
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user