Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Ticket #8880 (closed defect: untested)

Opened 1 year ago

Last modified 11 months ago

Element.cleanWhitespace defect in IE

Reported by: Typer85 Assigned to: mislav
Priority: normal Milestone: 1.x
Component: Prototype Version: edge
Severity: normal Keywords: IE
Cc:

Description

Microsoft Internet Explorer does not follow the W3C DOM Specification and incorrectly ignores whitespace only text nodes. If the Prototype Library Function 'Element.cleanWhitespace( )' is used with Microsoft Internet Explorer. it will remove all nodes, not just whitespace only text nodes as it documents, possibly because of this bug in Microsoft Internet Explorer.

This becomes of extreme annoyance when one wants to walk the DOM using Prototype but also wants to ignore whitespace only text nodes.

To get passed this, I simply do a check for Microsoft Internet Explorer and then decide whether to call 'Element.cleanWhitespace( )' on the element I am going to walk through.

Following is a simple example:

# This example assumes that the element that will be walked through is returned
# from an AJAX Response XML Object.

if( navigator.appName == 'Microsoft Internet Explorer' ) {

        Xml = responseObject.responseXML.documentElement;
    }
    else {

        Xml = Element.cleanWhitespace( responseObject.responseXML.documentElement );
    }

I really do think that 'Element.cleanWhitespace( )' should be able to detect the browser automatically and act accordingly.

This code has only been tested in Mozilla Firefox 2.0.x.x and Microsoft Internet Explorer 6.x/7.x.

Change History

08/19/07 14:45:42 changed by mislav

  • status changed from new to assigned.
  • severity changed from major to normal.
  • summary changed from Element.cleanWhitespace Incorrectly Returning Elements In Microsoft Internet Explorer to Element.cleanWhitespace defect in IE.
  • priority changed from high to normal.
  • owner changed from sam to mislav.
  • keywords changed from Prototype, Element.Cleanwhitespace to IE.

Can you please provide a patch with a failing test case?

08/19/07 14:45:59 changed by mislav

  • status changed from assigned to closed.
  • resolution set to untested.