Skip to content
This repository has been archived by the owner on Sep 20, 2019. It is now read-only.

document.execCommand('insertOrderedList') fails in Firefox when target was template content #209

Closed
bigdave opened this issue Feb 18, 2015 · 5 comments

Comments

@bigdave
Copy link

bigdave commented Feb 18, 2015

When using Firefox and the webcomponentsjs polyfills, the commands document.execCommand('insertOrderedList') or document.execCommand('insertUnorderedList') return true, but fail to add the appropriate markup for list elements when called on a selection within a contenteditable element which originated from within a template, and exists in Shadow DOM. If a similar area is added directly to a shadow root without having been cloned from a template, it seems to work still.

Curiously, other commands, such as 'bold' do work as expected. This is demonstrated in the following fiddles.

Where I'm running into this as an issue is contenteditable inside of polymer elements, since they use templates.

I'm seeing this behavior in Firefox as early as v26, and as recently as v37.

Steps to reproduce:
I have two fiddles, one demonstrating the functionality working inside of Shadow DOM, and one demonstrating the functionality failing inside of Shadow DOM when cloned from a template. These must be viewed from within Firefox in order for the failed one to fail, of course - it works in latest Chrome, Safari, Opera, and Vivaldi.

@bigdave
Copy link
Author

bigdave commented Feb 18, 2015

Reporting this with WebComponents version 0.5.4.

@garlicnation
Copy link
Contributor

@bigdave To clarify, was this working in firefox v25, or had you not encountered it until v26?

@bigdave
Copy link
Author

bigdave commented Mar 16, 2015

@garlicnation Sorry - I don't know if it was working in v25, I simply have not encountered it until v26. I can not confirm how it was working before that. The issue is still present in Firefox nightlys today.

@eeid26
Copy link
Contributor

eeid26 commented Mar 16, 2015

Any document.execCommand that adds or remove nodes in the contenteditable element will corrupt the polyfill wrapper element childNodes.
see this #212

I tried to work on a fix for a while and it was too much work. I doubt this ever worked in the polyfill.

@TimvdLippe
Copy link
Contributor

Thanks for the issue. It has been a great while since this issue was opened. Sadly, this issue misses a live reproduction with the most recent version of the webcomponents polyfill for us to be able to debug and potentially fix. Versions 1 of the polyfills fix a large amount of issues, probably including this one as well.

Please see the CONTRIBUTING.md for guidelines on filing issues. You can start from this jsBin template as a starting point and link it in the issue template under "Live Demo".

Feel free to file a new issue following these instructions if you can still reproduce this issue with versions 1 of the polyfills. Thank you!

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

No branches or pull requests

4 participants