Closed Bug 30838 Opened 24 years ago Closed 11 years ago

complete implementation of nsRange interface

Categories

(Core :: DOM: Core & HTML, defect, P3)

defect

Tracking

()

RESOLVED WORKSFORME
Future

People

(Reporter: Brade, Assigned: kinmoz)

References

Details

(Keywords: dom2, helpwanted, testcase)

Attachments

(8 files)

Here is a snippet from an e-mail by Vidur:
Well...there are a few NS_ERROR_NOT_IMPLEMENTEDs in nsRange.cpp and the current 
version of the spec (http://www.w3.org/TR/DOM-Level-2/range.html) includes some 
new errors and exceptions. Last I heard from Joe, completing the implementation 
was not on his list.

I am creating this bug for tracking purposes but I don't expect Joe to get to it 
soon.  Maybe someone else can pick this up?  If not, hopefully it can wait until 
later in the development cycle.
Target Milestone: M19
M19 for now
Keywords: helpwanted
accepting bug
Status: NEW → ASSIGNED
Marking FUTURE. Netscape can survive without complete nsRange for FCS.
Target Milestone: M19 → Future
I'd like to suggest that at least nsRange::CloneContents/ExtractContents be 
implemented soon. It appears to be mostly complete already. 

Since the contents of a range cannot be extracted, currently the only usefulness 
of creating a range is the ability to delete it. 

The only way I can manipulate a range of the DOM right now is to use .innerHTML 
instead of ranges and then dump the content back into 
createContextualFragment(). 
This has been split into four bugs, one for each unimplemented method:
extractContents: http://bugzilla.mozilla.org/show_bug.cgi?id=58969
cloneContents: http://bugzilla.mozilla.org/show_bug.cgi?id=58970
insertNode: http://bugzilla.mozilla.org/show_bug.cgi?id=58972
surroundContents: http://bugzilla.mozilla.org/show_bug.cgi?id=58974

A limited testcase is posted for each.
All are assigned to anothonyd@netscape.com
Keywords: dom2
Component: DOM Level 2 → DOM Traversal-Range
I am attaching a JavaScript "Patch" that can be used as a work around for the 
range object.  This patch adds support for the following:
    Range.innerHTML - read only
    Range.extractContents - as per W3C specs
    Range.cloneContents - as per W3C specs
    Range.insertNode - as per W3C specs
    Range.surroundContents - as per W3C specs
    Range.deleteContents - as per W3C specs - fixes buggy support from Mozilla
    Range.jmyCompareNode - extends Mozilla's compareNode to include
                           the following 2 constants
    Range.NODE_BEFORE_AND_INSIDE = -1;
    Range.NODE_INSIDE_AND_AFTER = -2;

I would like a C++ programmer to implement these in C if possible.

Jeff Yates
Adding patch and test cases as text files since zip is not attaching properly.

Jeff
Attached file JS Patch File
Attached file Insert Node Test Case
The complete functionality of the Range object cannot be accomplished until 
ownerDocument bug (bug #27382) is fixed.  

As stated in bug 27382, the ownerDocument property of all orphaned nodes is 
null, thus the Range object cannot set container points within orphaned nodes 
(it generates a NS_ERROR_INVALID_POINTER).  This is against the purpose of the 
range object.  It is supposed to be able to navigate a DocumentFragment, which 
by definition is not attached to a document.

Jeff.
Depends on: 27382
My final version of the Range Object Patch via JavaScript is now available.  
The first versions were concentrating upon HTML applications.  I have now 
corrected this oversite.  Since people have been having a problem with my 
attachments you can download the patch from http://pbwizard.com/Moz%
20Patches/RangePatch.zip.  Included in the zip file are the test cases that I 
used to test my script.

Jeff Yates.
Bad news.  I have just put in a bug (Bug #73552) that ALL of the comparison 
methods of the Range object fail if the range is the contents of an Attr 
object.  This is a major step back and my "Patch" does not fix this ... yet.

Jeff.
sicking: are you interested in converting this JS to C++? I know you've been
doing this sort of thing recently.

Gerv
I'll look into it after I'm done with the treeWalker (bug 82625). But wasn't 
most of nsRange fixed recently?
Yes, most of this was fixed.  This and 58969 seem to be duplicates now.
more range for kin...
Assignee: jfrancis → kin
Status: ASSIGNED → NEW
Keywords: testcase
Depends on: 58969
Depends on: 120366
Attachment #27659 - Attachment mime type: text/plain → text/html
Depends on: 101191
Depends on: 43535
Depends on: 58974
Depends on: 127180
Depends on: 135922
Depends on: 135928
Depends on: 149320
Depends on: 191864
QA Contact: vidur → traversal-range
Any remaining issues can be filed as separate bugs.
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → WORKSFORME
Component: DOM: Traversal-Range → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.