Opened 7 years ago

Closed 7 years ago

#14512 closed defect (fixed)

exception in parser.instantiate() on IE6/IE7 when String.split() modified to work per spec

Reported by: Martin Repta Owned by: bill
Priority: high Milestone: 1.8
Component: Parser Version: 1.7.1
Keywords: parser IE7 Cc:
Blocked By: Blocking:

Description

there is a bug in IE7 with Invalid argument

eror message from IE7: Message: Invalid argument. Line: 161 Char: 6 Code: 0

This bug appears when method getAttributeNode(param) is calling. The problem appears when param is an empty string. All major browsers except IE7 will return null, however IE7 throws an error.

Solution is simple, patch file attached.

Attachments (1)

dojo_parser.patch (697 bytes) - added by Martin Repta 7 years ago.

Download all attachments as: .zip

Change History (6)

comment:1 Changed 7 years ago by bill

You'll need to provide a test case for this and every ticket, because as far as I know the current code on IE7 is working fine. Thanks.

comment:2 Changed 7 years ago by mm

Here is status after several hours of debugging this: OK you are right code works on MSIE7 fine. We have tested this in combination with libary that fixed String.prototype.split to behave consistently with specification. This code relies on fact that MSIE7 dos not support attributes and "RELIES" incorrectly on fact that " a b".spit returns 2 items. While correct version of split shall return 3 items ["","a","b"] and the code fails.

Actually the check: if(has("dom-attributes-explicit")) is not sufficient and the code could be more robust.

attributes = darray.map(attrs.split(/\s+/), function(name){

is the line that produces "unexpected" array.

Just for the record the library modifying String.prototype.split is popular "syntaxhighlighter_3.0.83".

We are working on fix/test and let you know, soon.

Changed 7 years ago by Martin Repta

Attachment: dojo_parser.patch added

comment:3 Changed 7 years ago by mm

Actually the fixed split comes even deeper from http://xregexp.com

comment:4 Changed 7 years ago by bill

Milestone: tbd1.8
Status: newassigned
Summary: bug in dojo.parser.instantiate IE7exception in parser.instantiate() on IE6/IE7 when String.split() modified to work per spec

Ah I see, good one. I didn't know that split() (according to spec) works that way. Too bad, as the IE behavior seems more useful.

Anyway, your fix to make sure the attrs string is trimmed makes sense, I'll check that in. Thanks for tracking down what was really going on.

comment:5 Changed 7 years ago by bill

Resolution: fixed
Status: assignedclosed

In [27457]:

Trim attrs string before calling split(), so that when another library overrides IE's String.split() to work according to spec, a value of attrs like " data-dojo-type data-dojo-params " won't split into an array with blanks, like ["", "data-dojo-type", "data-dojo-params", ""]. Fixes #14512 !strict. Thanks martinerko for the fix.

Note: See TracTickets for help on using tickets.