Skip to content
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

fixContainer produces a tree with invalid content #343

Open
mossymaker opened this issue Jan 27, 2019 · 0 comments
Open

fixContainer produces a tree with invalid content #343

mossymaker opened this issue Jan 27, 2019 · 0 comments

Comments

@mossymaker
Copy link

Steps

  1. copy the text from this Pen
  2. paste the text into Squire
  3. Use Squire's getHTML method; save the resulting DOMString somewhere
  4. Use setHTML to restore the DOMString into Squire

Expected: content appears as it did when pasted
Actual: content has additional spacing

Notes

The spacing is caused by giving invalid markup to the editor's root element innerHTML. The invalid markup is introduced when fixContainer wraps inline content with a <div>, but without checking whether the wrapper element is a permitted child of the enclosing element (e.g. <div> is not a permitted in a <span>).

When setHTML gives the content to the root element's innerHTML, the browser doesn't create the same tree from when innerHTML was read.

I have a fix for this...brb.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant