Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Editing issues, replaceSelectionWithNode: and DOMRange setStart::



On 27.8.2007, at 10:09, Darin Adler wrote:

Hi and thanks for the fast answer!

The issue here is that selections aren't arbitrary DOM ranges. They correspond only to what users see; so the selection begins at the first character inside the H1 element and ends at the first character on the next line.

Does that mean I should really manipulate the DOM objects to make changes to the DOM tree? I guess replaceSelectionWithNode: is then just for modifications coming through the UI (or for modifications not really caring about what the DOM tree will look like)?


I think that WebKit ought to make it easier to do these kinds of changes in an undoable way.

That would be great! Should I file a bug, and what would be the magic words for that bug?



If your original selection was inside some text, then the container of the range endpoint was a text node, and the offset was the character inside the text where the selection began.

Ah, of course. How stupid of me! :) I forgot that, because I was the massaging the actually selected DOM text node to the H1 node, its parent. Thanks a lot!


My problems are solved! Thanks again!

--
   Petteri Kamppuri
   email@hidden


_______________________________________________ Do not post admin requests to the list. They will be ignored. Webkitsdk-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webkitsdk-dev/email@hidden

This email sent to email@hidden
References: 
 >Editing issues, replaceSelectionWithNode: and DOMRange setStart:: (From: Petteri Kamppuri <email@hidden>)
 >Re: Editing issues, replaceSelectionWithNode: and DOMRange setStart:: (From: Darin Adler <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.