-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issues in IE 11 #1756
Issues in IE 11 #1756
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -121,6 +121,8 @@ class Html { | |
*/ | ||
|
||
deserialize = (html, options = {}) => { | ||
// Provides default value to make it working in IE 11. | ||
html = html || '<p></p>' | ||
const { toJSON = false } = options | ||
const { defaultBlock, parseHtml } = this | ||
const fragment = parseHtml(html) | ||
|
@@ -327,8 +329,8 @@ class Html { | |
const { document } = value | ||
const elements = document.nodes.map(this.serializeNode).filter(el => el) | ||
if (options.render === false) return elements | ||
|
||
const html = renderToStaticMarkup(<body>{elements}</body>) | ||
// Converts List to Array to support IE 11. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could this and similar comments be updated to say |
||
const html = renderToStaticMarkup(<body>{elements.toArray()}</body>) | ||
const inner = html.slice(6, -7) | ||
return inner | ||
} | ||
|
@@ -343,14 +345,17 @@ class Html { | |
serializeNode = node => { | ||
if (node.object === 'text') { | ||
const leaves = node.getLeaves() | ||
return leaves.map(this.serializeLeaf) | ||
const children = leaves.map(this.serializeLeaf); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks like this semicolon needs to be removed. |
||
// Converts List to Array to support IE 11. | ||
return children.toArray() | ||
} | ||
|
||
const children = node.nodes.map(this.serializeNode) | ||
|
||
for (const rule of this.rules) { | ||
if (!rule.serialize) continue | ||
const ret = rule.serialize(node, children) | ||
// Converts List to Array to support IE 11. | ||
const ret = rule.serialize(node, children.toArray()) | ||
if (ret === null) return | ||
if (ret) return addKey(ret) | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we update this comment to something along these lines:
COMPAT: Provide a default value for IE11 support