[Webkit-unassigned] [Bug 10881] New: Selecting the entire range of an inline element causes the element to be deleted

bugzilla-daemon at opendarwin.org bugzilla-daemon at opendarwin.org
Sat Sep 16 00:53:34 PDT 2006


http://bugzilla.opendarwin.org/show_bug.cgi?id=10881

           Summary: Selecting the entire range of an inline element causes
                    the element to be deleted
           Product: WebKit
           Version: 419.x
          Platform: Macintosh
        OS/Version: Mac OS X 10.4
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: HTML Editing
        AssignedTo: webkit-unassigned at opendarwin.org
        ReportedBy: robburns1 at mac.com


Selecting the entire range of an inline element causes the element to be
deleted and replaced by a <span> element with class="apple-style-span". The
following code reproduces the problem. This is an attempt at a workaround for
another bug (to be reported). WebView generally has problems with
selectedDOMRange navigation (keyboard and programmatically)  editing problems
when working near the bondary of an element.

                if ([selectedRange collapsed]) {

                        textPlaceholder = [theDOMDocument createTextNode:
                                [NSString stringWithFormat:@"%c%c%c",
                                        8203, 8203, 8203]];
                        textPlaceholder2 = [theDOMDocument createTextNode:
                                [NSString stringWithFormat:@"%c",
                                        8203]];                 
                        textPlaceholder3 = [theDOMDocument createTextNode:
                                [NSString stringWithFormat:@"%c",
                                        8203]];                 


                        [newElement appendChild:textPlaceholder];

                        [selectedRange insertNode:newElement];
                        if (debugState == YES) NSLog(@"the selected range is:
%@", selectedRange);

                        // if these are set to  0 and 3 (selecting the entire
range of newElement the newElement
                       // will be replaced by an apple style span wrapping the
entire paragraph set to
                       //  "font-style:normal" and another set to
"font-style:bold"
                        [selectedRange setStart:textPlaceholder :1];
                        [selectedRange setEnd:textPlaceholder :2];

                        elementInsertionRange = selectedRange;
                        if (debugState == YES) NSLog(@"the selected range is:
%@", selectedRange);
                        [webView display];

                } else {

                        aFragment = [selectedRange cloneContents];
                        NSLog(@"aFragment is %@", [aFragment textContent]);
                        [newElement appendChild:aFragment];
                        // [selectedRange surroundContents:newElement];
                        [webView replaceSelectionWithNode:newElement];
                }


-- 
Configure bugmail: http://bugzilla.opendarwin.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.



More information about the webkit-unassigned mailing list