11/* http://keith-wood.name/svg.html
2- jQuery DOM compatibility for jQuery SVG v1.4.4 .
2+ jQuery DOM compatibility for jQuery SVG v1.4.5 .
33 Written by Keith Wood (kbwood{at}iinet.com.au) April 2009.
44 Dual licensed under the GPL (http://dev.jquery.com/browser/trunk/jquery/GPL-LICENSE.txt) and
55 MIT (http://dev.jquery.com/browser/trunk/jquery/MIT-LICENSE.txt) licenses.
@@ -93,7 +93,7 @@ $.fn.hasClass = function(origHasClass) {
9393$ . fn . attr = function ( origAttr ) {
9494 return function ( name , value , type ) {
9595 if ( typeof name === 'string' && value === undefined ) {
96- var val = origAttr . apply ( this , [ name , value , type ] ) ;
96+ var val = origAttr . apply ( this , [ name ] ) ;
9797 if ( val && val . baseVal && val . baseVal . numberOfItems != null ) { // Multiple values
9898 value = '' ;
9999 val = val . baseVal ;
@@ -165,9 +165,9 @@ $.extend($.cssNumber, {
165165/* Support retrieving CSS/attribute values on SVG nodes. */
166166if ( $ . cssProps ) {
167167 $ . css = function ( origCSS ) {
168- return function ( elem , name ) {
168+ return function ( elem , name , extra ) {
169169 var value = ( name . match ( / ^ s v g .* / ) ? $ ( elem ) . attr ( $ . cssProps [ name ] || name ) : '' ) ;
170- return value || origCSS ( elem , name ) ;
170+ return value || origCSS ( elem , name , extra ) ;
171171 } ;
172172 } ( $ . css ) ;
173173}
@@ -289,44 +289,57 @@ $.expr.filter.ATTR = function(origFilterAttr) {
289289} ( $ . expr . filter . ATTR ) ;
290290
291291/*
292- In the event.add function (line 2646, v1.6.2):
292+ In the removeData function (line 1881, v1.7.2):
293+
294+ if ( jQuery.support.deleteExpando ) {
295+ delete elem[ internalKey ];
296+ } else {
297+ try { // SVG
298+ elem.removeAttribute( internalKey );
299+ } catch (e) {
300+ elem[ internalKey ] = null;
301+ }
302+ }
303+
304+ In the event.add function (line 2985, v1.7.2):
293305
294306 if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
295307 // Bind the global event handler to the element
296308 try { // SVG
297309 elem.addEventListener( type, eventHandle, false );
298-
299310 } catch(e) {
300- if (elem.attachEvent)
311+ if ( elem.attachEvent ) {
301312 elem.attachEvent( "on" + type, eventHandle );
313+ }
302314 }
303315 }
304316
305- In the event.remove function (line 2776 , v1.6 .2):
317+ In the event.remove function (line 3074 , v1.7 .2):
306318
307- if ( !special.teardown || special.teardown.call( elem, namespaces ) === false ) {
308- try { // SVG
309- elem.removeEventListener(type, elemData.handle, false);
310- }
311- catch (e) {
312- if (elem.detachEvent)
313- elem.detachEvent("on" + type, elemData.handle);
319+ if ( !special.teardown || special.teardown.call( elem, namespaces ) === false ) {
320+ try { // SVG
321+ elem.removeEventListener(type, elemData.handle, false);
322+ }
323+ catch (e) {
324+ if (elem.detachEvent) {
325+ elem.detachEvent("on" + type, elemData.handle);
314326 }
315327 }
328+ }
316329
317- In the event.fix function (line 3036, v.1.6.2)
330+ In the event.fix function (line 3394, v1.7.2):
318331
319332 if (event.target.namespaceURI == 'http://www.w3.org/2000/svg') { // SVG
320333 event.button = [1, 4, 2][event.button];
321334 }
322335
323336 // Add which for click: 1 === left; 2 === middle; 3 === right
324337 // Note: button is not normalized, so don't use it
325- if ( !event.which && event. button !== undefined ) {
326- event.which = (event. button & 1 ? 1 : ( event. button & 2 ? 3 : ( event. button & 4 ? 2 : 0 ) ));
338+ if ( !event.which && button !== undefined ) {
339+ event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) );
327340 }
328341
329- In the Sizzle function (line 3873 , v1.6 .2):
342+ In the Sizzle function (line 4083 , v1.7 .2):
330343
331344 if ( toString.call(checkSet) === "[object Array]" ) {
332345 if ( !prune ) {
@@ -335,7 +348,7 @@ $.expr.filter.ATTR = function(origFilterAttr) {
335348 } else if ( context && context.nodeType === 1 ) {
336349 for ( i = 0; checkSet[i] != null; i++ ) {
337350 if ( checkSet[i] && (checkSet[i] === true || checkSet[i].nodeType === 1 && Sizzle.contains(context, checkSet[i])) ) {
338- results.push( set[i] || set.item(i) ); // SVG
351+ results.push( set[i] || set.item(i) ); // SVG
339352 }
340353 }
341354
@@ -346,28 +359,27 @@ $.expr.filter.ATTR = function(origFilterAttr) {
346359 }
347360 }
348361 }
362+ } else {...
349363
350- } else {
364+ In the fallback for the Sizzle makeArray function (line 4877, v1.7.2):
351365
352- In the fallback for the Sizzle makeArray function (line 4617, v1.6.2):
366+ if ( toString.call(array) === "[object Array]" ) {
367+ Array.prototype.push.apply( ret, array );
353368
354- if ( toString.call(array) === "[object Array]" ) {
355- Array.prototype.push.apply( ret, array );
369+ } else {
370+ if ( typeof array.length === "number" ) {
371+ for ( var l = array.length; i < l; i++ ) {
372+ ret.push( array[i] || array.item(i) ); // SVG
373+ }
356374
357375 } else {
358- if ( typeof array.length === "number" ) {
359- for ( var l = array.length; i < l; i++ ) {
360- ret.push( array[i] || array.item(i) ); // SVG
361- }
362-
363- } else {
364- for ( ; array[i]; i++ ) {
365- ret.push( array[i] );
366- }
376+ for ( ; array[i]; i++ ) {
377+ ret.push( array[i] );
367378 }
368379 }
380+ }
369381
370- In the jQuery.cleanData function (line 6220 , v1.6 .2)
382+ In the jQuery.cleandata function (line 6538 , v1.7 .2):
371383
372384 if ( deleteExpando ) {
373385 delete elem[ jQuery.expando ];
@@ -380,12 +392,14 @@ $.expr.filter.ATTR = function(origFilterAttr) {
380392 }
381393 }
382394
383- In the fallback getComputedStyle function (line 6509, v.1.6.2)
395+ In the fallback getComputedStyle function (line 6727, v1.7.2):
384396
385397 defaultView = (elem.ownerDocument ? elem.ownerDocument.defaultView : elem.defaultView); // SVG
386- if ( !defaultView ) {
387- return undefined;
388- }
398+ if ( defaultView &&
399+ (computedStyle = defaultView.getComputedStyle( elem, null )) ) {
400+
401+ ret = computedStyle.getPropertyValue( name );
402+ ...
389403
390404*/
391405
0 commit comments