YUILibrary - Open source JavaScript and CSS for building richly interactive software.
Fork YUI on GitHub

YUI 2.x

Ticket #2528006 (accepted defect)

Reporter


Steve Calvert
Opened: 05/17/09
Last modified: 05/26/09
Status: accepted
Type: defect

Owner


Matt Sweeney
Target Release: 2.NEXT
Priority: P3 (normal)
Summary: YUI Selector fails in IE8 Compatibility mode
Description:

By default when running against sites in your intranet zone IE8 switches to IE8 Compatibility Mode. Bu default when running against any other website on the internet IE8 switches to run in IE8
Standards Mode.

We have some code that is using the YUI selectors utility. These do not work correctly in the IE8 Standards Mode but do in IE8 Compatibility Mode.

We also are using the meta tag to emulate IE7, which seems to have little effect here.

An example of some code that is failing:

var selectedImage = $$('div.on img.display')[0];

The above returns null or undefined in IE8 (I can't remember which) when in Standards Mode. This code succeeds in FF2/3, Safari, IE6/7.

Type: defect Observed in Version: 2.7.0
Component: Selector Severity: S3 (normal)
Assigned To: Matt Sweeney Target Release: 2.NEXT
Location: Priority: P3 (normal)
Tags: IE8 selector Relates To:
Browsers: IE 8.x
URL:
Test Information:

Change History

Matt Sweeney

YUI Developer

Posted: 05/18/09
  • milestone changed to 2.NEXT
  • priority changed to P3 (normal)
  • status changed from new to accepted

Steve Calvert

Posted: 05/19/09

I need to clarify some of the details of this ticket, as they are incorrect.

1. It seems that the selector utility is failing in Standards Mode, not Compatibility Mode.
2. The code snippet supplied is a bit difficult to understand. The YAHOO.util.Selector.query function is mapped to $$ for convenience. This isn't clear in my code above.

Kaven Yan

Posted: 05/26/09

Compatibility View and the X-UA-Compatible tag are not equivalent via http://blogs.msdn.com/ie/archive/2009/02/16/just-the-facts-recap-of-compatibility-view.aspx
If anything,this is YAHOO.env.ua.ie's bug。
I fix it in line 642 of selector.js:

raw: if (YAHOO.env.ua.ie && YAHOO.env.ua.ie < 8) { // rewrite class for IE < 8

fixed:if(YAHOO.env.ua.ie && ((!document.documentMode && YAHOO.env.ua.ie<8) || document.documentMode < 8)){// rewrite class for IE < 8