Firefox throws error in Sizzle due to XHTML violation in feature check #1969

Closed
herbalite opened this Issue Dec 25, 2014 · 9 comments

Comments

Projects
None yet
6 participants
@herbalite

Under circumstances, that I have not yet been able to reproduce as a simple test case Firefox 34 throws a system error.

In Firebug I get the following error output. The invisible char in the output below (after select id="sizzle1419480912644-invisible char" is in fact a line feed shown by Firebug.

...4'></a><select id='sizzle1419480912644-]' msallowcapture=''><option selected=''...

malformed input

From the popup over the error code my guestimate it is an issue of mix between XHTML and HTML tags.
As the in the popup over the error line the link reads

<html xmlns="http://www.w3.org/1999/xhtml"><div xmlns="http://www.w3.org/1999/xhtml"><a id="sizzle1419480912644"></a><select id='sizzle1419480912644-]' msallowcapture=''><option selected=''...

So there's the switch from xhtml to html
The source code for 2.1.3 for this issue is found on line 1176 and has the following code

                "<select id='" + expando + "-\f]' msallowcapture=''>" +

That code changed from 2.1.1. to 2.1.3 and the issue it seems to be that -\f is being interpreted by Firefox as a line feed and trips up Firefox. With other browsers I don't see this issue. The issue is also present in the minified version.

Except for the showing in the debugger however the page appears to work fine. So for me it's not a show stopper, but a step backwards from 2.1.1

@dmethvin

This comment has been minimized.

Show comment
Hide comment
@dmethvin

dmethvin Dec 28, 2014

Member

The change was in jquery/sizzle@aca006d and since assert() adds a try/catch it shouldn't cause any problem. It does skip the remaining feature tests but none of those appear to be used in Firefox. So it seems like this is a potential problem but not currently causing any bugs.

Member

dmethvin commented Dec 28, 2014

The change was in jquery/sizzle@aca006d and since assert() adds a try/catch it shouldn't cause any problem. It does skip the remaining feature tests but none of those appear to be used in Firefox. So it seems like this is a potential problem but not currently causing any bugs.

@dmethvin dmethvin added this to the 3.0.0 milestone Dec 28, 2014

@mgol

This comment has been minimized.

Show comment
Hide comment
@mgol

mgol Dec 28, 2014

Member

Fortunately we have tests for reported support tests results:

if ( /chrome/i.test( userAgent ) ) {
// Catches Chrome on Android as well (i.e. the default
// Android browser on Android >= 4.4).
expected = {
"ajax": true,
"boxSizingReliable": true,
"checkClone": true,
"checkOn": true,
"clearCloneStyle": true,
"cors": true,
"createHTMLDocument": true,
"focusinBubbles": false,
"noCloneChecked": true,
"optDisabled": true,
"optSelected": true,
"pixelPosition": true,
"radioValue": true,
"reliableMarginRight": true
};
} else if ( /(msie 10\.0|trident\/7\.0)/i.test( userAgent ) ) {
expected = {
"ajax": true,
"boxSizingReliable": false,
"checkClone": true,
"checkOn": true,
"clearCloneStyle": false,
"cors": true,
"createHTMLDocument": true,
"focusinBubbles": true,
"noCloneChecked": false,
"optDisabled": true,
"optSelected": false,
"pixelPosition": true,
"radioValue": false,
"reliableMarginRight": true
};
} else if ( /msie 9\.0/i.test( userAgent ) ) {
expected = {
"ajax": true,
"boxSizingReliable": false,
"checkClone": true,
"checkOn": true,
"clearCloneStyle": false,
"cors": false,
"createHTMLDocument": true,
"focusinBubbles": true,
"noCloneChecked": false,
"optDisabled": true,
"optSelected": false,
"pixelPosition": true,
"radioValue": false,
"reliableMarginRight": true
};
} else if ( /8.0(\.\d+|) safari/i.test( userAgent ) ) {
expected = {
"ajax": true,
"boxSizingReliable": true,
"checkClone": true,
"checkOn": true,
"clearCloneStyle": true,
"cors": true,
"createHTMLDocument": false,
"focusinBubbles": false,
"noCloneChecked": true,
"optDisabled": true,
"optSelected": true,
"pixelPosition": false,
"radioValue": true,
"reliableMarginRight": true
};
} else if ( /(6|7)\.0(\.\d+|) safari/i.test( userAgent ) ) {
expected = {
"ajax": true,
"boxSizingReliable": true,
"checkClone": true,
"checkOn": true,
"clearCloneStyle": true,
"cors": true,
"createHTMLDocument": true,
"focusinBubbles": false,
"noCloneChecked": true,
"optDisabled": true,
"optSelected": true,
"pixelPosition": false,
"radioValue": true,
"reliableMarginRight": true
};
} else if ( /firefox/i.test( userAgent ) ) {
expected = {
"ajax": true,
"boxSizingReliable": true,
"checkClone": true,
"checkOn": true,
"clearCloneStyle": true,
"cors": true,
"createHTMLDocument": true,
"focusinBubbles": false,
"noCloneChecked": true,
"optDisabled": true,
"optSelected": true,
"pixelPosition": true,
"radioValue": true,
"reliableMarginRight": true
};
} else if ( /iphone os 8/i.test( userAgent ) ) {
expected = {
"ajax": true,
"boxSizingReliable": true,
"checkClone": true,
"checkOn": true,
"clearCloneStyle": true,
"cors": true,
"createHTMLDocument": false,
"focusinBubbles": false,
"noCloneChecked": true,
"optDisabled": true,
"optSelected": true,
"pixelPosition": false,
"radioValue": true,
"reliableMarginRight": true
};
} else if ( /iphone os (6|7)/i.test( userAgent ) ) {
expected = {
"ajax": true,
"boxSizingReliable": true,
"checkClone": true,
"checkOn": true,
"clearCloneStyle": true,
"cors": true,
"createHTMLDocument": true,
"focusinBubbles": false,
"noCloneChecked": true,
"optDisabled": true,
"optSelected": true,
"pixelPosition": false,
"radioValue": true,
"reliableMarginRight": true
};
} else if ( /android 4\.[0-3]/i.test( userAgent ) ) {
expected = {
"ajax": true,
"boxSizingReliable": true,
"checkClone": false,
"checkOn": false,
"clearCloneStyle": true,
"cors": true,
"createHTMLDocument": true,
"focusinBubbles": false,
"noCloneChecked": true,
"optDisabled": true,
"optSelected": true,
"pixelPosition": false,
"radioValue": true,
"reliableMarginRight": true
};
} else if ( /android 2\.3/i.test( userAgent ) ) {
expected = {
"ajax": true,
"boxSizingReliable": true,
"checkClone": true,
"checkOn": false,
"clearCloneStyle": false,
"cors": true,
"createHTMLDocument": true,
"focusinBubbles": false,
"noCloneChecked": true,
"optDisabled": false,
"optSelected": true,
"pixelPosition": false,
"radioValue": true,
"reliableMarginRight": false
};
}

so if any result changed, we'd detect that.

That is, unless a problem exists in XHTML mode only which we (cough) currently don't test.

Member

mgol commented Dec 28, 2014

Fortunately we have tests for reported support tests results:

if ( /chrome/i.test( userAgent ) ) {
// Catches Chrome on Android as well (i.e. the default
// Android browser on Android >= 4.4).
expected = {
"ajax": true,
"boxSizingReliable": true,
"checkClone": true,
"checkOn": true,
"clearCloneStyle": true,
"cors": true,
"createHTMLDocument": true,
"focusinBubbles": false,
"noCloneChecked": true,
"optDisabled": true,
"optSelected": true,
"pixelPosition": true,
"radioValue": true,
"reliableMarginRight": true
};
} else if ( /(msie 10\.0|trident\/7\.0)/i.test( userAgent ) ) {
expected = {
"ajax": true,
"boxSizingReliable": false,
"checkClone": true,
"checkOn": true,
"clearCloneStyle": false,
"cors": true,
"createHTMLDocument": true,
"focusinBubbles": true,
"noCloneChecked": false,
"optDisabled": true,
"optSelected": false,
"pixelPosition": true,
"radioValue": false,
"reliableMarginRight": true
};
} else if ( /msie 9\.0/i.test( userAgent ) ) {
expected = {
"ajax": true,
"boxSizingReliable": false,
"checkClone": true,
"checkOn": true,
"clearCloneStyle": false,
"cors": false,
"createHTMLDocument": true,
"focusinBubbles": true,
"noCloneChecked": false,
"optDisabled": true,
"optSelected": false,
"pixelPosition": true,
"radioValue": false,
"reliableMarginRight": true
};
} else if ( /8.0(\.\d+|) safari/i.test( userAgent ) ) {
expected = {
"ajax": true,
"boxSizingReliable": true,
"checkClone": true,
"checkOn": true,
"clearCloneStyle": true,
"cors": true,
"createHTMLDocument": false,
"focusinBubbles": false,
"noCloneChecked": true,
"optDisabled": true,
"optSelected": true,
"pixelPosition": false,
"radioValue": true,
"reliableMarginRight": true
};
} else if ( /(6|7)\.0(\.\d+|) safari/i.test( userAgent ) ) {
expected = {
"ajax": true,
"boxSizingReliable": true,
"checkClone": true,
"checkOn": true,
"clearCloneStyle": true,
"cors": true,
"createHTMLDocument": true,
"focusinBubbles": false,
"noCloneChecked": true,
"optDisabled": true,
"optSelected": true,
"pixelPosition": false,
"radioValue": true,
"reliableMarginRight": true
};
} else if ( /firefox/i.test( userAgent ) ) {
expected = {
"ajax": true,
"boxSizingReliable": true,
"checkClone": true,
"checkOn": true,
"clearCloneStyle": true,
"cors": true,
"createHTMLDocument": true,
"focusinBubbles": false,
"noCloneChecked": true,
"optDisabled": true,
"optSelected": true,
"pixelPosition": true,
"radioValue": true,
"reliableMarginRight": true
};
} else if ( /iphone os 8/i.test( userAgent ) ) {
expected = {
"ajax": true,
"boxSizingReliable": true,
"checkClone": true,
"checkOn": true,
"clearCloneStyle": true,
"cors": true,
"createHTMLDocument": false,
"focusinBubbles": false,
"noCloneChecked": true,
"optDisabled": true,
"optSelected": true,
"pixelPosition": false,
"radioValue": true,
"reliableMarginRight": true
};
} else if ( /iphone os (6|7)/i.test( userAgent ) ) {
expected = {
"ajax": true,
"boxSizingReliable": true,
"checkClone": true,
"checkOn": true,
"clearCloneStyle": true,
"cors": true,
"createHTMLDocument": true,
"focusinBubbles": false,
"noCloneChecked": true,
"optDisabled": true,
"optSelected": true,
"pixelPosition": false,
"radioValue": true,
"reliableMarginRight": true
};
} else if ( /android 4\.[0-3]/i.test( userAgent ) ) {
expected = {
"ajax": true,
"boxSizingReliable": true,
"checkClone": false,
"checkOn": false,
"clearCloneStyle": true,
"cors": true,
"createHTMLDocument": true,
"focusinBubbles": false,
"noCloneChecked": true,
"optDisabled": true,
"optSelected": true,
"pixelPosition": false,
"radioValue": true,
"reliableMarginRight": true
};
} else if ( /android 2\.3/i.test( userAgent ) ) {
expected = {
"ajax": true,
"boxSizingReliable": true,
"checkClone": true,
"checkOn": false,
"clearCloneStyle": false,
"cors": true,
"createHTMLDocument": true,
"focusinBubbles": false,
"noCloneChecked": true,
"optDisabled": false,
"optSelected": true,
"pixelPosition": false,
"radioValue": true,
"reliableMarginRight": false
};
}

so if any result changed, we'd detect that.

That is, unless a problem exists in XHTML mode only which we (cough) currently don't test.

@gibson042 gibson042 referenced this issue in jquery/sizzle Dec 30, 2014

Closed

Support test outputs invalid XHTML #304

gibson042 added a commit to jquery/sizzle that referenced this issue Dec 30, 2014

@dmethvin dmethvin self-assigned this Jan 5, 2015

@dmethvin

This comment has been minimized.

Show comment
Hide comment
@dmethvin

dmethvin Jan 5, 2015

Member

This will be fixed when we merge the latest sizzle.

Member

dmethvin commented Jan 5, 2015

This will be fixed when we merge the latest sizzle.

@dmethvin dmethvin changed the title from 2.1.3 throws system error after upgrading from 2.1.1 (Firefox 34) to Firefox throws error in Sizzle due to XHTML violation in feature check Jan 5, 2015

@dmethvin dmethvin added the Selector label Jan 15, 2015

@timmywil timmywil closed this in 3a0dd5a Apr 13, 2015

timmywil added a commit that referenced this issue Apr 13, 2015

idupree added a commit to mbta-bus-app/mbta-bus-app.github.io that referenced this issue Aug 18, 2015

Update libraries
(jquery is updated to 1.11.1 instead of 1.11.3 because the fix
for jquery/jquery#1969 bug which was introduced
in 1.11.2 isn't out yet)

timmywil added a commit that referenced this issue Nov 10, 2015

@pmorch

This comment has been minimized.

Show comment
Hide comment
@pmorch

pmorch Dec 1, 2015

I interpret the Closed status and Milestone 3.0.0 as: "It won't get fixed in 2.X but it'll be fixed in 3.0 when it releases" - but that there isn't a supported version with this fix in now.

For the next person to google this, I was using jqGrid when I noticed the "not well-formed" in the console after an upgrade to jQuery 2.1.4. Not to be confused with other threads of people using jqGrid with actual malformed XML. (Coincidentally(?), the OP @herbalite is a contributor to free-jqgrid).

Also for the next person to google this, issue #2196 has a link to a fiddle that simply reproduces the problem.

I also verifyied that jquery/sizzle@50ebe1a fixed the problem for me too, by applying that patch manually to 2.1.4.

pmorch commented Dec 1, 2015

I interpret the Closed status and Milestone 3.0.0 as: "It won't get fixed in 2.X but it'll be fixed in 3.0 when it releases" - but that there isn't a supported version with this fix in now.

For the next person to google this, I was using jqGrid when I noticed the "not well-formed" in the console after an upgrade to jQuery 2.1.4. Not to be confused with other threads of people using jqGrid with actual malformed XML. (Coincidentally(?), the OP @herbalite is a contributor to free-jqgrid).

Also for the next person to google this, issue #2196 has a link to a fiddle that simply reproduces the problem.

I also verifyied that jquery/sizzle@50ebe1a fixed the problem for me too, by applying that patch manually to 2.1.4.

@dmethvin

This comment has been minimized.

Show comment
Hide comment
@dmethvin

dmethvin Dec 1, 2015

Member

I'm pretty sure this will be in the 1.12.0/2.2.0 release that we plan to do later this month, since it was in the Sizzle update. @gibson042 can you confirm that's the case and update the milestone if so?

Member

dmethvin commented Dec 1, 2015

I'm pretty sure this will be in the 1.12.0/2.2.0 release that we plan to do later this month, since it was in the Sizzle update. @gibson042 can you confirm that's the case and update the milestone if so?

@gibson042 gibson042 reopened this Dec 2, 2015

@gibson042 gibson042 modified the milestones: 1.12/2.2, 3.0.0 Dec 2, 2015

@gibson042

This comment has been minimized.

Show comment
Hide comment
@gibson042

gibson042 Dec 2, 2015

Member

Confirmed.

Member

gibson042 commented Dec 2, 2015

Confirmed.

@gibson042 gibson042 closed this Dec 2, 2015

@tbaddade tbaddade referenced this issue in redaxo/redaxo Dec 21, 2015

Closed

Javascript Fehler / SVG Logo #518

@cssmagic cssmagic referenced this issue in cssmagic/ChangeLog May 18, 2016

Open

jQuery #5

@thdoan

This comment has been minimized.

Show comment
Hide comment
@thdoan

thdoan May 31, 2018

Hi, I arrived at this issue because I'm getting the same error in Chrome v66 on a page that uses jQuery 2.2.4 and the WYMeditor plugin. There's a way to reproduce this error almost every time in a very specific case: using a mutation observer that contains document.querySelector('[for="' + elAdded.id + '"]').

I've uploaded a test page here:
http://www.tohodo.com/tests/1.html

You should see this error in the console:
image

thdoan commented May 31, 2018

Hi, I arrived at this issue because I'm getting the same error in Chrome v66 on a page that uses jQuery 2.2.4 and the WYMeditor plugin. There's a way to reproduce this error almost every time in a very specific case: using a mutation observer that contains document.querySelector('[for="' + elAdded.id + '"]').

I've uploaded a test page here:
http://www.tohodo.com/tests/1.html

You should see this error in the console:
image

@dmethvin

This comment has been minimized.

Show comment
Hide comment
@dmethvin

dmethvin May 31, 2018

Member

@thdoan If you can reproduce that using http://code.jquery.com/jquery-git.js then report a new issue. Otherwise it's been fixed in the past and you should upgrade.

Member

dmethvin commented May 31, 2018

@thdoan If you can reproduce that using http://code.jquery.com/jquery-git.js then report a new issue. Otherwise it's been fixed in the past and you should upgrade.

@thdoan

This comment has been minimized.

Show comment
Hide comment
@thdoan

thdoan Jun 1, 2018

WYMeditor doesn't support jQuery 3.x, but thanks I've managed to avoid this rare scenario for the time being.

thdoan commented Jun 1, 2018

WYMeditor doesn't support jQuery 3.x, but thanks I've managed to avoid this rare scenario for the time being.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment