mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-21 06:31:28 +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.nodeName == '#text') {
|
||||||
if (el.value && el.value.match(/<!--.*?-->/)) return
|
if (el.nodeValue && el.nodeValue.match(/<!--.*?-->/)) return
|
||||||
|
|
||||||
return {
|
return {
|
||||||
kind: 'text',
|
kind: 'text',
|
||||||
leaves: [{
|
leaves: [{
|
||||||
kind: 'leaf',
|
kind: 'leaf',
|
||||||
text: el.value || el.nodeValue
|
text: el.nodeValue
|
||||||
}]
|
}]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -395,7 +395,7 @@ class Html {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
cruftNewline = (element) => {
|
cruftNewline = (element) => {
|
||||||
return !(element.nodeName === '#text' && element.value == '\n')
|
return !(element.nodeName === '#text' && element.nodeValue == '\n')
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user