Closed Bug 347932 Opened 18 years ago Closed 18 years ago

compareDocumentPosition() method returns hex values masquerading as decimal values

Categories

(Firefox :: General, defect)

PowerPC
macOS
defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: dannyg, Unassigned)

Details

User-Agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.8.0.6) Gecko/20060728 Firefox/1.5.0.6 Build Identifier: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.8.0.6) Gecko/20060728 Firefox/1.5.0.6 The Node.compareDocumentPosition() method returns hexadecimal values in decimal clothing. This prevents testing equality against the comparision constants, which evaluate to decimal values. This affects two constants: const unsigned short DOCUMENT_POSITION_CONTAINED_BY = 0x10; const unsigned short DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC = 0x20; document.body.compareDocumentPosition(document.body.parentNode) // returns 10 Node.DOCUMENT_POSITION_CONTAINED_BY // evaluates to 16 document.body.compareDocumentPosition(document.body.parentNode) == Node.DOCUMENT_POSITION_CONTAINED_BY // evaluates to false parseInt(document.body.compareDocumentPosition(document.body.parentNode),16) == Node.DOCUMENT_POSITION_CONTAINED_BY // evaluates to true Or is my perception of the DOM Level 3 spec twisted around, and the constants should be returning hex values? Reproducible: Always
Duh, bit masks. Nothing to see here.
Status: UNCONFIRMED → RESOLVED
Closed: 18 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.