1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-08-21 14:41:23 +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:
Yoel
2018-01-04 18:08:25 -05:00
committed by Ian Storm Taylor
parent bfe3124b01
commit a6c56a2c56

View File

@@ -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')
} }
} }