Closed Bug 97939 Opened 23 years ago Closed 21 years ago

myObj instanceof HTMLDocument == false // always

Categories

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

x86
All
defect

Tracking

()

RESOLVED WORKSFORME
Future

People

(Reporter: hattons, Unassigned)

Details

Attachments

(2 files)

The results of the following code seem wrong, and others using older builds have
attested to different (i.e., correct) results.

var testStr = "(pad instanceof HTMLDocument) = "+(pad instanceof HTMLDocument) 
+ ";  pad = " + pad + "<br>";
        
pad.writeln(testStr);
testStr =  "(pad instanceof Object) = " + (pad instanceof Object)
+ ";  pad = " + pad +"<br>";

pad.writeln(testStr);

// output: 
// (pad instanceof HTMLDocument) = false; pad = [object HTMLDocument]
// should be true -----------------^^^^^  observe-------^^^^^^^^^^^^
// (pad instanceof Object) = true; pad = [object HTMLDocument]

function chk(p) { alert(p instanceof HTMLDocument) };
chk(window.open().document); // prints 'false' should be 'true'

I tested the same code on NT and got the same results.
Browser, not engine --> DOM Level 0.

Steve - FWIW, how are you defining the variable 'pad'? 
Assignee: rogerl → jst
Component: Javascript Engine → DOM Level 0
QA Contact: pschwartau → desale
Reduced testcase attached. jst, here's a fun one.
window.document is of type [HTMLDocument], and window.document instanceof
HTMLDocument returns true.
Now if I open a new window, get the document of this new window, its type is
[HTMLDocument], but newWindow.document instanceof HTMLDocument returns false.
Does anyone understand?
Marking NEW.
Status: UNCONFIRMED → NEW
Ever confirmed: true
OS: Linux → All
newWindow.document instanceof newWindow.HTMLDocument works, we're currently not
sharing classes across scopes, so this won't work when doing cross-window coding...

Won't be fixed any time soon unless this is fixed as part of some other more
important bug.
Target Milestone: --- → Future
Severity = LOW [No Crash, No severe functional failure, No Cosmetic failure]
Visibility = MEDIUM [Dont see any real world website usage, Gets one point of 
compatibility with other browsers, since reporter says it used to work on older 
builds. gets one more point on compliance with adopted techonology, that is JS] 

Priority = Visibility * Severity

Priority = p4

adding word "qawanted" because I'm setting this priority on available data & if 
someone feels otherwise then please investigate this more & feel free to change 
this priority.
Keywords: qawanted
Priority: -- → P4
Mozilla
Build ID: 2003020208
Platform: i386
OS: Windows 2000

This works for me. Both test cases show "true" as expected.
Mass-reassigning bugs to dom_bugs@netscape.com
Assignee: jst → dom_bugs
Yeah, as comment 7 suggests, this works now.  Resolving.
Status: NEW → RESOLVED
Closed: 21 years ago
Resolution: --- → WORKSFORME
Keywords: qawanted
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: