Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
herbalite opened this issue Dec 25, 2014 · 9 comments
Closed
Assignees
Labels
Milestone

Comments

@herbalite
Copy link

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
Copy link
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.

@dmethvin dmethvin added this to the 3.0.0 milestone Dec 28, 2014
@mgol
Copy link
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.

@dmethvin
Copy link
Member

dmethvin commented Jan 5, 2015

This will be fixed when we merge the latest sizzle.

@dmethvin dmethvin changed the title 2.1.3 throws system error after upgrading from 2.1.1 (Firefox 34) Firefox throws error in Sizzle due to XHTML violation in feature check Jan 5, 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
(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
Copy link

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
Copy link
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
Copy link
Member

Confirmed.

@thdoan
Copy link

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
Copy link
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.

@thdoan
Copy link

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.

@lock lock bot locked as resolved and limited conversation to collaborators Nov 28, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Development

No branches or pull requests

6 participants