My favorites | Sign in
Project Home Issues Source
READ-ONLY: This project has been archived. For more information see this post.
Search
for
  Advanced search   Search tips   Subscriptions
Issue 24: fails on Safari, Mac, news.cnet.com
1 person starred this issue and may be notified of changes. Back to list
Status:  Fixed
Owner:  stevesou...@gmail.com
Closed:  Sep 2009


 
Project Member Reported by stevesou...@gmail.com, Sep 2, 2009
Works on most sites but fails on http://news.cnet.com/ in Safari (4.0.3) on
Mac.
Sep 10, 2009
Project Member #1 stevesou...@gmail.com
(No comment was entered for this change.)
Labels: -Priority-Medium Priority-High Milestone-Release1.0
Sep 22, 2009
Project Member #2 stevesou...@gmail.com
(No comment was entered for this change.)
Labels: Milestone-NextRelease
Sep 22, 2009
Project Member #3 stevesou...@gmail.com
CNet uses MooTools which redefines getElementsByClassName which causes a conflict
with Sizzle in jQuery (wow, that's a mouthful). I entered a bug:
http://dev.jquery.com/ticket/5284 but patched a workaround for now.

SpriteMe? (http://spriteme.org/) is a bookmarklet that uses jquery-1.3.2.js. A user
reported a bug running SpriteMe? on http://news.cnet.com/ in Safari on the Mac. The
issue results from this code in jquery-1.3.2.js (from Sizzle):

if ( document.getElementsByClassName &&
document.documentElement.getElementsByClassName ) (function(){

    var div = document.createElement("div"); div.innerHTML = "<div class='test
e'></div><div class='test'></div>";

    // Opera can't find a second classname (in 9.6) if (
div.getElementsByClassName("e").length === 0 )

        return;

    // Safari caches class attributes, doesn't catch changes (in 3.2)
div.lastChild.className = "e";

    if ( div.getElementsByClassName("e").length === 1 )

The error occurs when the last line is executed:

TypeError?: Result of expression '$.element' [undefined] is not a function.
i.i.com.com/cnwk.1d/html/rb/js/tron/oreo.moo.rb.combined.js:6

CNet uses mootools which redefines getElementsByClassName, and this causes the error.
I can avoid the error by testing that getElementsByClassName is a native method:

if ( document.getElementsByClassName &&
-1!=document.getElementsByClassName.toString().indexOf("native code") &&
document.documentElement.getElementsByClassName ) (function(){ 
Status: Fixed

Powered by Google Project Hosting