Internet Explorer

This page does not present a script called IE. This page talks about the difficulties I had with this navigator. I do not like IE, I dislike IE, I do not recommend IE, I spend too much time discovering IE lacks or special undocumented "features", It's probably true to say that I hate IE...

Alexandre SIMON.

HTMLElement

Attributes

Discover the power of IE HTMLElement (IE 6.0.2900.2180.xpsp_sp2_gdr.050301-1519) and its attributes. IE HTMLElement declares some extra attributes ; above the attributes for the current paragraph :

[language => ], [dataFld => null], [onmouseup => null], [class => ], [oncontextmenu => null], [onrowexit => null], [onbeforepaste => null], [onactivate => null], [lang => ], [onmousemove => null], [onmove => null], [onselectstart => null], [oncontrolselect => null], [onkeypress => null], [oncut => null], [onrowenter => null], [onmousedown => null], [onpaste => null], [id => ], [onreadystatechange => null], [onbeforedeactivate => null], [hideFocus => false], [dir => ], [onkeydown => null], [onlosecapture => null], [ondrag => null], [ondragstart => null], [oncellchange => null], [onfilterchange => null], [onrowsinserted => null], [ondatasetcomplete => null], [onmousewheel => null], [ondragenter => null], [onblur => null], [onresizeend => null], [onerrorupdate => null], [onbeforecopy => null], [ondblclick => null], [onkeyup => null], [onresizestart => null], [onmouseover => null], [onmouseleave => null], [onmoveend => null], [title => ], [onresize => null], [contentEditable => inherit], [dataFormatAs => null], [ondrop => null], [onpage => null], [onrowsdelete => null], [style => null], [onfocusout => null], [ondatasetchanged => null], [ondeactivate => null], [onpropertychange => null], [ondragover => null], [onhelp => null], [ondragend => null], [onbeforeeditfocus => null], [disabled => false], [onfocus => null], [accessKey => ], [onscroll => null], [onbeforeactivate => null], [onbeforecut => null], [dataSrc => null], [onclick => printAttributes(this);], [oncopy => null], [onfocusin => null], [tabIndex => 0], [onbeforeupdate => null], [ondataavailable => null], [onmovestart => null], [onmouseout => null], [onmouseenter => null], [onlayoutcomplete => null], [implementation => null], [onafterupdate => null], [ondragleave => null], [cite => null], [align => ], [width => null], [clear => ]

Compared to the source code (<p>Discover the power of ...</p>), IE's HTMLElement seem's to be more PoWeRfUL... but is it really ? ; extra attributes seem to be only null or empty attributes ; we will change printAttributes to printNonNullAttributes (non null means here attr.value != null && attr.value != "") :

[dataFld => null], [onmouseup => null], [oncontextmenu => null], [onrowexit => null], [onbeforepaste => null], [onactivate => null], [onmousemove => null], [onmove => null], [onselectstart => null], [oncontrolselect => null], [onkeypress => null], [oncut => null], [onrowenter => null], [onmousedown => null], [onpaste => null], [onreadystatechange => null], [onbeforedeactivate => null], [hideFocus => false], [onkeydown => null], [onlosecapture => null], [ondrag => null], [ondragstart => null], [oncellchange => null], [onfilterchange => null], [onrowsinserted => null], [ondatasetcomplete => null], [onmousewheel => null], [ondragenter => null], [onblur => null], [onresizeend => null], [onerrorupdate => null], [onbeforecopy => null], [ondblclick => null], [onkeyup => null], [onresizestart => null], [onmouseover => null], [onmouseleave => null], [onmoveend => null], [onresize => null], [contentEditable => inherit], [dataFormatAs => null], [ondrop => null], [onpage => null], [onrowsdelete => null], [style => null], [onfocusout => null], [ondatasetchanged => null], [ondeactivate => null], [onpropertychange => null], [ondragover => null], [onhelp => null], [ondragend => null], [onbeforeeditfocus => null], [disabled => false], [onfocus => null], [onscroll => null], [onbeforeactivate => null], [onbeforecut => null], [dataSrc => null], [onclick => printAttributes(this);], [oncopy => null], [onfocusin => null], [tabIndex => 0], [onbeforeupdate => null], [ondataavailable => null], [onmovestart => null], [onmouseout => null], [onmouseenter => null], [onlayoutcomplete => null], [implementation => null], [onafterupdate => null], [ondragleave => null], [cite => null], [width => null]

Zut! IE is really more PoWeRfUL : null values are Strings values "null", not NULL value !
Conclusion : use outerHTML property when you want to print or write an Element HTML version. Don't try to write it iterating the attributes HTMLCollection.

hasAttribute(s) ?

IE HTMLElement does NOT support hasAttribute(attrName) or hasAttributes() methods. These are DOM Level 2 methods. IE does NOT play with DOM Level 2 methods ; it is very more PoWeRfUL ; it plays in an other dimension.

Conclusion : use something like attributes.length > 0 for hasAttributes(), something like getAttribute(attrName) != null for hasAttribute(attrName).

More PoWeRfUL

To come...

Upper