Skip to content Skip to sidebar Skip to footer

How To Select A Node In A Range With Webkit Browsers?

I'm currently working on a WYSIWYG solution and need a function to correctly select with a range a node (by this I mean the node itself, not only it's content) DOM lvl2 clearly hav

Solution 1:

The problem is not with selectNode(), which works fine in WebKit, but with WebKit's selection object, which mangles ranges to fit in with its own (not always unreasonable) idea of where selection boundaries and caret positions are allowed to be. There are bugs filed against this with WebKit:

You're right, Rangy does not deal with this, preferring instead to reflect the reality of the browser's native selection. Pretending the selection is different would quickly lead to odd behaviour.


Post a Comment for "How To Select A Node In A Range With Webkit Browsers?"