[SPIP Zone] [Spip-zone-commit] r26190 - /_plugins_/_stable_/crayons/js/jquery.js

Pourquoi le mettre aussi ici alors qu'il est dans le core ?

Le 25 janv. 09 à 13:29, fil@rezo.net a écrit :

Author: fil@rezo.net
Date: Sun Jan 25 13:29:20 2009
New Revision: 26190

Log:
jQuery 1.3.1, petit commit pour se remettre en jambes

Modified:
   _plugins_/_stable_/crayons/js/jquery.js

Modified: _plugins_/_stable_/crayons/js/jquery.js

======================================================================
--- _plugins_/_stable_/crayons/js/jquery.js (original)
+++ _plugins_/_stable_/crayons/js/jquery.js Sun Jan 25 13:29:20 2009
@@ -1,13 +1,13 @@
/*!
- * jQuery JavaScript Library v1.3
+ * jQuery JavaScript Library v1.3.1
* http://jquery.com/
*
* Copyright (c) 2009 John Resig
* Dual licensed under the MIT and GPL licenses.
* License | jQuery
*
- * Date: 2009-01-13 12:50:31 -0500 (Tue, 13 Jan 2009)
- * Revision: 6104
+ * Date: 2009-01-21 20:42:16 -0500 (Wed, 21 Jan 2009)
+ * Revision: 6158
*/
(function(){

@@ -60,21 +60,17 @@
        else {
          var elem = document.getElementById( match[3] );

- // Make sure an element was located
- if ( elem ){
            // Handle the case where IE and Opera return items
            // by name instead of ID
- if ( elem.id != match[3] )
+ if ( elem && elem.id != match[3] )
              return jQuery().find( selector );

            // Otherwise, we inject the element directly into the jQuery object
- var ret = jQuery( elem );
+ var ret = jQuery( elem || );
            ret.context = document;
            ret.selector = selector;
            return ret;
          }
- selector = ;
- }

      // HANDLE: $(expr, [context])
      // (which is just equivalent to: $(content).find(expr)
@@ -99,7 +95,7 @@
  selector: "",

  // The current version of jQuery being used
- jquery: "1.3",
+ jquery: "1.3.1",

  // The number of elements contained in the matched element set
  size: function() {
@@ -634,8 +630,8 @@

  // check if an element is in a (or is an) XML document
  isXMLDoc: function( elem ) {
- return elem.documentElement && !elem.body ||
- elem.tagName && elem.ownerDocument && !elem.ownerDocument.body;
+ return elem.nodeType === 9 && elem.documentElement.nodeName !== "HTML" ||
+ !!elem.ownerDocument && jQuery.isXMLDoc( elem.ownerDocument );
  },

  // Evalulates a script in a global context
@@ -725,7 +721,7 @@

    // internal only, use hasClass("class")
    has: function( elem, className ) {
- return jQuery.inArray( className, (elem.className || elem).toString().split(/\s+/) ) > -1;
+ return elem && jQuery.inArray( className, (elem.className || elem).toString().split(/\s+/) ) > -1;
    }
  },

@@ -999,7 +995,9 @@
          var attributeNode = elem.getAttributeNode( "tabIndex" );
          return attributeNode && attributeNode.specified
            ? attributeNode.value
- : elem.nodeName.match(/^(a|area|button|input|object|select|textarea)$/i)
+ : elem.nodeName.match(/(button|input|object|select|textarea)/i)
+ ? 0
+ : elem.nodeName.match(/^(a|area)$/i) && elem.href
              ? 0
              : undefined;
        }
@@ -1397,14 +1395,14 @@
    });
  }
});/*!
- * Sizzle CSS Selector Engine - v0.9.1
+ * Sizzle CSS Selector Engine - v0.9.3
* Copyright 2009, The Dojo Foundation
* Released under the MIT, BSD, and GPL Licenses.
* More information: http://sizzlejs.com/
*/
(function(){

-var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|[^[\]]+)+\]|\\.|[^ >+~,(\+)+|[>+~])(\s*,\s*)?/g,
+var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]+['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\+)+|[>+~])(\s*,\s*)?/g,
  done = 0,
  toString = Object.prototype.toString;

@@ -1433,26 +1431,17 @@
    }
  }

- if ( parts.length > 1 && Expr.match.POS.exec( selector ) ) {
+ if ( parts.length > 1 && origPOS.exec( selector ) ) {
    if ( parts.length === 2 && Expr.relative[ parts[0] ] ) {
- var later = "", match;
-
- // Position selectors must be done after the filter
- while ( (match = Expr.match.POS.exec( selector )) ) {
- later += match[0];
- selector = selector.replace( Expr.match.POS, "" );
- }
-
- set = Sizzle.filter( later, Sizzle( /\s$/.test(selector) ? selector + "*" : selector, context ) );
+ set = posProcess( parts[0] + parts[1], context );
    } else {
      set = Expr.relative[ parts[0] ] ?
        [ context ] :
        Sizzle( parts.shift(), context );

      while ( parts.length ) {
- var tmpSet = ;
-
        selector = parts.shift();
+
        if ( Expr.relative[ selector ] )
          selector += parts.shift();

@@ -1456,17 +1445,13 @@
        if ( Expr.relative[ selector ] )
          selector += parts.shift();

- for ( var i = 0, l = set.length; i < l; i++ ) {
- Sizzle( selector, set[i], tmpSet );
- }
-
- set = tmpSet;
+ set = posProcess( selector, set );
      }
    }
  } else {
    var ret = seed ?
      { expr: parts.pop(), set: makeArray(seed) } :
- Sizzle.find( parts.pop(), parts.length === 1 && context.parentNode ? context.parentNode : context );
+ Sizzle.find( parts.pop(), parts.length === 1 && context.parentNode ? context.parentNode : context, isXML(context) );
    set = Sizzle.filter( ret.expr, ret.set );

    if ( parts.length > 0 ) {
@@ -1531,7 +1516,7 @@
  return Sizzle(expr, null, null, set);
};

-Sizzle.find = function(expr, context){
+Sizzle.find = function(expr, context, isXML){
  var set, match;

  if ( !expr ) {
@@ -1546,7 +1531,7 @@

      if ( left.substr( left.length - 1 ) !== "\\" ) {
        match[1] = (match[1] || "").replace(/\\/g, "");
- set = Expr.find[ type ]( match, context );
+ set = Expr.find[ type ]( match, context, isXML );
        if ( set != null ) {
          expr = expr.replace( Expr.match[ type ], "" );
          break;
@@ -1568,7 +1553,7 @@
  while ( expr && set.length ) {
    for ( var type in Expr.filter ) {
      if ( (match = Expr.match[ type ].exec( expr )) != null ) {
- var filter = Expr.filter[ type ], goodArray = null, goodPos = 0, found, item;
+ var filter = Expr.filter[ type ], found, item;
        anyFound = false;

        if ( curLoop == result ) {
@@ -1582,26 +1567,13 @@
            anyFound = found = true;
          } else if ( match === true ) {
            continue;
- } else if ( match[0] === true ) {
- goodArray = ;
- var last = null, elem;
- for ( var i = 0; (elem = curLoop[i]) !== undefined; i++ ) {
- if ( elem && last !== elem ) {
- goodArray.push( elem );
- last = elem;
- }
- }
          }
        }

        if ( match ) {
- for ( var i = 0; (item = curLoop[i]) !== undefined; i++ ) {
+ for ( var i = 0; (item = curLoop[i]) != null; i++ ) {
            if ( item ) {
- if ( goodArray && item != goodArray[goodPos] ) {
- goodPos++;
- }
-
- found = filter( item, match, goodPos, goodArray );
+ found = filter( item, match, i, curLoop );
              var pass = not ^ !!found;

              if ( inplace && found != null ) {
@@ -1739,14 +1711,16 @@
    }
  },
  find: {
- ID: function(match, context){
- if ( context.getElementById ) {
+ ID: function(match, context, isXML){
+ if ( typeof context.getElementById !== "undefined" && !isXML ) {
        var m = context.getElementById(match[1]);
        return m ? [m] : ;
      }
    },
- NAME: function(match, context){
- return context.getElementsByName ? context.getElementsByName(match[1]) : null;
+ NAME: function(match, context, isXML){
+ if ( typeof context.getElementsByName !== "undefined" && !isXML ) {
+ return context.getElementsByName(match[1]);
+ }
    },
    TAG: function(match, context){
      return context.getElementsByTagName(match[1]);
@@ -1756,14 +1730,17 @@
    CLASS: function(match, curLoop, inplace, result, not){
      match = " " + match[1].replace(/\\/g, "") + " ";

- for ( var i = 0; curLoop[i]; i++ ) {
- if ( not ^ (" " + curLoop[i].className + " ").indexOf(match) >= 0 ) {
+ var elem;
+ for ( var i = 0; (elem = curLoop[i]) != null; i++ ) {
+ if ( elem ) {
+ if ( not ^ (" " + elem.className + " ").indexOf(match) >= 0 ) {
          if ( !inplace )
- result.push( curLoop[i] );
+ result.push( elem );
        } else if ( inplace ) {
          curLoop[i] = false;
        }
      }
+ }

      return false;
    },
@@ -1771,8 +1748,8 @@
      return match[1].replace(/\\/g, "");
    },
    TAG: function(match, curLoop){
- for ( var i = 0; !curLoop[i]; i++ ){}
- return isXML(curLoop[i]) ? match[1] : match[1].toUpperCase();
+ for ( var i = 0; curLoop[i] === false; i++ ){}
+ return curLoop[i] && isXML(curLoop[i]) ? match[1] : match[1].toUpperCase();
    },
    CHILD: function(match){
      if ( match[1] == "nth" ) {
@@ -1792,7 +1769,7 @@
      return match;
    },
    ATTR: function(match){
- var name = match[1];
+ var name = match[1].replace(/\\/g, "");
      
      if ( Expr.attrMap[name] ) {
        match[1] = Expr.attrMap[name];
@@ -1916,7 +1893,7 @@
    CHILD: function(elem, match){
      var type = match[1], parent = elem.parentNode;

- var doneName = "child" + parent.childNodes.length;
+ var doneName = match[0];
      
      if ( parent && (!parent[ doneName ] || !elem.nodeIndex) ) {
        var count = 1;
@@ -1985,7 +1962,7 @@
    ATTR: function(elem, match){
      var result = Expr.attrHandle[ match[1] ] ? Expr.attrHandle[ match[1] ]( elem ) : elem[ match[1] ] || elem.getAttribute( match[1] ), value = result + "", type = match[2], check = match[4];
      return result == null ?
- false :
+ type === "!=" :
        type === "=" ?
        value === check :
        type === "*=" ?
@@ -2014,6 +1991,8 @@
  }
};

+var origPOS = Expr.match.POS;
+
for ( var type in Expr.match ) {
  Expr.match[ type ] = RegExp( Expr.match[ type ].source + /(?![^\*\])(?![^\(]*\))/.source );
}
@@ -2072,15 +2051,15 @@
  // The workaround has to do additional checks after a getElementById
  // Which slows things down for other browsers (hence the branching)
  if ( !!document.getElementById( id ) ) {
- Expr.find.ID = function(match, context){
- if ( context.getElementById ) {
+ Expr.find.ID = function(match, context, isXML){
+ if ( typeof context.getElementById !== "undefined" && !isXML ) {
        var m = context.getElementById(match[1]);

[... 197 lines stripped ...]
_______________________________________________
Spip-zone-commit@rezo.net - http://listes.rezo.net/mailman/listinfo/spip-zone-commit

-Nicolas

--
Nicolas HOIZEY

* Nicolas Hoizey tapuscrivait, le 25/01/2009 20:25:

Pourquoi le mettre aussi ici alors qu'il est dans le core ?

Parce que le jquery de Crayons est appelé en tant que cquery et qu'il est indépendant de celui installé dans le core, permettant de fonctionner pareil en 1.9, 2.0 et 2.1

--
RealET

* RealET tapuscrivait, le 25/01/2009 20:31:

* Nicolas Hoizey tapuscrivait, le 25/01/2009 20:25:

Pourquoi le mettre aussi ici alors qu'il est dans le core ?

Parce que le jquery de Crayons est appelé en tant que cquery et qu'il est indépendant de celui installé dans le core, permettant de fonctionner pareil en 1.9, 2.0 et 2.1

Et Fil me souffle à l'oreillette sur IRC : ça permet en plus à crayon de fonctionner même sur les sites qui n'incluent pas jquery de SPIP...

--
RealET

Le 25 janv. 09 à 20:31, RealET a écrit :

* Nicolas Hoizey tapuscrivait, le 25/01/2009 20:25:

Pourquoi le mettre aussi ici alors qu'il est dans le core ?

Parce que le jquery de Crayons est appelé en tant que cquery et qu'il est indépendant de celui installé dans le core, permettant de fonctionner pareil en 1.9, 2.0 et 2.1

OK.

Est-ce que le jQuery de SPIP est utilisé quand il est disponible, pour éviter de charger des doublons ?

-Nicolas

--
Nicolas HOIZEY

Est-ce que le jQuery de SPIP est utilisé quand il est disponible, pour
éviter de charger des doublons ?

essaie et vois (la réponse est non)

-- Fil