Open Bug 455013 Opened 16 years ago Updated 2 years ago

permission denied on members of rangeParent object

Categories

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

x86
Windows XP
defect

Tracking

()

People

(Reporter: jeff-watts, Unassigned)

Details

User-Agent:       Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022)
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.1) Gecko/2008070208 Firefox/3.0.1

I have code for dragging over a text area that updates the selected area that works in IE (v_elText is the text area element):

var rng = v_elText.createTextRange();
rng.moveToPoint( e.x, e.y );
rng.select();

Since that doesn't work for Firefox, I wrote the following code that works in Firefox2:

var offset = e.rangeOffset;
offset = this.f_findLocation(e.rangeParent, e.rangeOffset);
v_elText.setSelectionRange( offset, offset );

where f_findLocation is following:

f_findLocation = function(elem, offset) {
while(elem.previousSibling)
{
	elem = elem.previousSibling;
	if (elem.length)
		offset += elem.length;
	else
		offset += 1;
}
return offset;
}

I try this in Firefox 3 and I get permission denied exception when attempting to access rangeParent.previousSibling.


On debugging, I see that in Firefox 2 rangeParent is a Text object as expected. In Firefox 3 rangeParent points to 
a HTMLDivElement (that presumably wraps the text area)
The error specifically is "Permission denied to get property HTMLDivElement.previousSibling"

Is this a bug (rangeParent not pointing to Text object in Firefox 3)?

Reproducible: Always

Steps to Reproduce:
1.
2.
3.
Actual Results:  
evt.rangeParent points to HtmlDivElement object

Expected Results:  
evt.rangeParent points to Text object
If you attach a testcase someone can test what bug fix is responsible for the regression.
Component: General → DOM
Product: Firefox → Core
QA Contact: general → general
The HTMLDivElement is the anonymous div for the textarea in this case.  Hard to say what the right rangeParent is offhand without the testcase Ria asked for.
We are facing the same problem in Firebug. The test case can be found here:
http://code.google.com/p/fbug/issues/detail?id=3843

Honza
The test case is available now.
Status: UNCONFIRMED → NEW
Ever confirmed: true
https://bugzilla.mozilla.org/show_bug.cgi?id=1472046

Move all DOM bugs that haven’t been updated in more than 3 years and has no one currently assigned to P5.

If you have questions, please contact :mdaly.
Priority: -- → P5
Component: DOM → DOM: Core & HTML
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.