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

Normalized HTML output #34

Open
antoniobrandao opened this issue Apr 21, 2014 · 1 comment
Open

Normalized HTML output #34

antoniobrandao opened this issue Apr 21, 2014 · 1 comment

Comments

@antoniobrandao
Copy link

Hello,

I've read that "document.execCommand" outputs different HTML in different browsers. This is not very good if we're to build a content-editing app that users use and switch across different browsers. Once they open the app in another browser, and try to edit the contents created in another browser, some browsers will probably not respond correctly.

http://www.quirksmode.org/dom/execCommand.html
"For instance, when making a selection bold, IE and Opera add a tag, while Mozilla adds a ."

I didn't test the html output in all browsers myself, so I'm not sure whether a normalization system is included in Etch.js, is there? If not, are there any ideas how to tackle this situtation?

Thanks

@joshontheweb
Copy link
Owner

Hi Antonio,

The problem is that browsers simply do it differently and have for a long time. Also I don't know of any real efforts on their parts to remedy the situation. The API's for contentEditable are pretty opaque and don't offer much in the way of customization of the output. The only way I can think of the have complete normalization between browsers would be to abandon using the API and roll our own. That would be A LOT of tricky code that would need a lot of cross-browser shimming since the selection API's are different in the browsers as well. I feel like the best thing to do is to be ok with some differences and keep the codebase lightweight. If someone wanted to rewrite all the contentEditable operations I would consider abstracting the calls in etch to make it possible to use a plugin like that, but it isn't something that I feel driven to do myself. I'm not even sure it is 100% possible. Its a tough problem and you aren't the first person to ask. In my own projects I have encouraged users to use the same browsers for best results. Seemed to work pretty well.

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

2 participants