Skip to content
Permalink
Browse files

Standardize on using double-quotes for string literals.

  • Loading branch information
jeresig committed Dec 22, 2009
1 parent 61e37d4 commit 3776cbe314ac6f5081e998c3d5ac84d3fbc51872
Showing with 31 additions and 30 deletions.
  1. +1 −1 src/ajax.js
  2. +2 −2 src/attributes.js
  3. +1 −1 src/core.js
  4. +3 −3 src/css.js
  5. +3 −2 src/event.js
  6. +1 −1 src/manipulation.js
  7. +19 −19 src/offset.js
  8. +1 −1 src/support.js
@@ -604,7 +604,7 @@ jQuery.extend({
function add( key, value ) {
// If value is a function, invoke it and return its value
value = jQuery.isFunction(value) ? value() : value;
s[ s.length ] = encodeURIComponent(key) + '=' + encodeURIComponent(value);
s[ s.length ] = encodeURIComponent(key) + "=" + encodeURIComponent(value);
}

// If an array was passed in, assume that it is an array of form elements.
@@ -137,7 +137,7 @@ jQuery.fn.extend({

// Typecast once if the value is a number
if ( typeof value === "number" ) {
value += '';
value += "";
}

var val = value;
@@ -149,7 +149,7 @@ jQuery.fn.extend({
// Typecast each time if the value is a Function and the appended
// value is therefore different each time.
if ( typeof val === "number" ) {
val += '';
val += "";
}
}

@@ -617,7 +617,7 @@ jQuery.extend({
// Use of jQuery.browser is frowned upon.
// More details: http://docs.jquery.com/Utilities/jQuery.browser
browser: {
version: (/.*?(?:firefox|safari|opera|msie)[\/ ]([\d.]+)/.exec(userAgent) || [0,'0'])[1],
version: (/.*?(?:firefox|safari|opera|msie)[\/ ]([\d.]+)/.exec(userAgent) || [0,"0"])[1],
safari: /safari/.test( userAgent ),
opera: /opera/.test( userAgent ),
msie: /msie/.test( userAgent ) && !/opera/.test( userAgent ),
@@ -56,13 +56,13 @@ jQuery.extend({
style.zoom = 1;

// Set the alpha filter to set the opacity
var opacity = parseInt( value, 10 ) + '' === "NaN" ? "" : "alpha(opacity=" + value * 100 + ")";
var filter = style.filter || jQuery.curCSS( elem, 'filter' ) || "";
var opacity = parseInt( value, 10 ) + "" === "NaN" ? "" : "alpha(opacity=" + value * 100 + ")";
var filter = style.filter || jQuery.curCSS( elem, "filter" ) || "";
style.filter = ralpha.test(filter) ? filter.replace(ralpha, opacity) : opacity;
}

return style.filter && style.filter.indexOf("opacity=") >= 0 ?
(parseFloat( ropacity.exec(style.filter)[1] ) / 100) + '':
(parseFloat( ropacity.exec(style.filter)[1] ) / 100) + "":
"";
}

@@ -230,6 +230,7 @@ jQuery.event = {
if ( !elem ) {
// Don't bubble custom events when global (to avoid too much overhead)
event.stopPropagation();

// Only trigger if we've ever bound an event for it
if ( this.global[ type ] ) {
jQuery.each( jQuery.cache, function() {
@@ -824,8 +825,8 @@ jQuery.fn.extend({

return this.click( jQuery.event.proxy( fn, function( event ) {
// Figure out which function to execute
var lastToggle = ( jQuery.data( this, 'lastToggle' + fn.guid ) || 0 ) % i;
jQuery.data( this, 'lastToggle' + fn.guid, lastToggle + 1 );
var lastToggle = ( jQuery.data( this, "lastToggle" + fn.guid ) || 0 ) % i;
jQuery.data( this, "lastToggle" + fn.guid, lastToggle + 1 );

// Make sure that clicks stop
event.preventDefault();
@@ -380,7 +380,7 @@ jQuery.extend({

jQuery.each(elems, function( i, elem ) {
if ( typeof elem === "number" ) {
elem += '';
elem += "";
}

if ( !elem ) {
@@ -95,10 +95,10 @@ if ( "getBoundingClientRect" in document.documentElement ) {

jQuery.offset = {
initialize: function() {
var body = document.body, container = document.createElement('div'), innerDiv, checkDiv, table, td, bodyMarginTop = parseFloat( jQuery.curCSS(body, 'marginTop', true) ) || 0,
html = '<div style="position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;"><div></div></div><table style="position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;" cellpadding="0" cellspacing="0"><tr><td></td></tr></table>';
var body = document.body, container = document.createElement("div"), innerDiv, checkDiv, table, td, bodyMarginTop = parseFloat( jQuery.curCSS(body, "marginTop", true) ) || 0,
html = "<div style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;'><div></div></div><table style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;' cellpadding='0' cellspacing='0'><tr><td></td></tr></table>";

jQuery.extend( container.style, { position: 'absolute', top: 0, left: 0, margin: 0, border: 0, width: '1px', height: '1px', visibility: 'hidden' } );
jQuery.extend( container.style, { position: "absolute", top: 0, left: 0, margin: 0, border: 0, width: "1px", height: "1px", visibility: "hidden" } );

container.innerHTML = html;
body.insertBefore( container, body.firstChild );
@@ -109,12 +109,12 @@ jQuery.offset = {
this.doesNotAddBorder = (checkDiv.offsetTop !== 5);
this.doesAddBorderForTableAndCells = (td.offsetTop === 5);

checkDiv.style.position = 'fixed', checkDiv.style.top = '20px';
checkDiv.style.position = "fixed", checkDiv.style.top = "20px";
// safari subtracts parent border width here which is 5px
this.supportsFixedPosition = (checkDiv.offsetTop === 20 || checkDiv.offsetTop === 15);
checkDiv.style.position = checkDiv.style.top = '';
checkDiv.style.position = checkDiv.style.top = "";

innerDiv.style.overflow = 'hidden', innerDiv.style.position = 'relative';
innerDiv.style.overflow = "hidden", innerDiv.style.position = "relative";
this.subtractsBorderForOverflowNotVisible = (checkDiv.offsetTop === -5);

this.doesNotIncludeMarginInBodyOffset = (body.offsetTop !== bodyMarginTop);
@@ -130,28 +130,28 @@ jQuery.offset = {
jQuery.offset.initialize();

if ( jQuery.offset.doesNotIncludeMarginInBodyOffset ) {
top += parseFloat( jQuery.curCSS(body, 'marginTop', true) ) || 0;
left += parseFloat( jQuery.curCSS(body, 'marginLeft', true) ) || 0;
top += parseFloat( jQuery.curCSS(body, "marginTop", true) ) || 0;
left += parseFloat( jQuery.curCSS(body, "marginLeft", true) ) || 0;
}

return { top: top, left: left };
},

setOffset: function( elem, options ) {
// set position first, in-case top/left are set even on static elem
if ( /static/.test( jQuery.curCSS( elem, 'position' ) ) ) {
elem.style.position = 'relative';
if ( /static/.test( jQuery.curCSS( elem, "position" ) ) ) {
elem.style.position = "relative";
}
var curElem = jQuery( elem ),
curOffset = curElem.offset(),
curTop = parseInt( jQuery.curCSS( elem, 'top', true ), 10 ) || 0,
curLeft = parseInt( jQuery.curCSS( elem, 'left', true ), 10) || 0,
curTop = parseInt( jQuery.curCSS( elem, "top", true ), 10 ) || 0,
curLeft = parseInt( jQuery.curCSS( elem, "left", true ), 10) || 0,
props = {
top: (options.top - curOffset.top) + curTop,
left: (options.left - curOffset.left) + curLeft
};

if ( 'using' in options ) {
if ( "using" in options ) {
options.using.call( elem, props );
} else {
curElem.css( props );
@@ -178,12 +178,12 @@ jQuery.fn.extend({
// Subtract element margins
// note: when an element has margin: auto the offsetLeft and marginLeft
// are the same in Safari causing offset.left to incorrectly be 0
offset.top -= parseFloat( jQuery.curCSS(elem, 'marginTop', true) ) || 0;
offset.left -= parseFloat( jQuery.curCSS(elem, 'marginLeft', true) ) || 0;
offset.top -= parseFloat( jQuery.curCSS(elem, "marginTop", true) ) || 0;
offset.left -= parseFloat( jQuery.curCSS(elem, "marginLeft", true) ) || 0;

// Add offsetParent borders
parentOffset.top += parseFloat( jQuery.curCSS(offsetParent[0], 'borderTopWidth', true) ) || 0;
parentOffset.left += parseFloat( jQuery.curCSS(offsetParent[0], 'borderLeftWidth', true) ) || 0;
parentOffset.top += parseFloat( jQuery.curCSS(offsetParent[0], "borderTopWidth", true) ) || 0;
parentOffset.left += parseFloat( jQuery.curCSS(offsetParent[0], "borderLeftWidth", true) ) || 0;

// Subtract the two offsets
return {
@@ -195,7 +195,7 @@ jQuery.fn.extend({
offsetParent: function() {
return this.map(function() {
var offsetParent = this.offsetParent || document.body;
while ( offsetParent && (!/^body|html$/i.test(offsetParent.nodeName) && jQuery.css(offsetParent, 'position') === 'static') ) {
while ( offsetParent && (!/^body|html$/i.test(offsetParent.nodeName) && jQuery.css(offsetParent, "position") === "static") ) {
offsetParent = offsetParent.offsetParent;
}
return offsetParent;
@@ -234,7 +234,7 @@ jQuery.each( ["Left", "Top"], function( i, name ) {
win = getWindow( elem );

// Return the scroll offset
return win ? ('pageXOffset' in win) ? win[ i ? 'pageYOffset' : 'pageXOffset' ] :
return win ? ("pageXOffset" in win) ? win[ i ? "pageYOffset" : "pageXOffset" ] :
jQuery.support.boxModel && win.document.documentElement[ method ] ||
win.document.body[ method ] :
elem[ method ];
@@ -8,7 +8,7 @@
id = "script" + now();

div.style.display = "none";
div.innerHTML = ' <link/><table></table><a href="/a" style="color:red;float:left;opacity:.55;">a</a><select><option>text</option></select>';
div.innerHTML = " <link/><table></table><a href='/a' style='color:red;float:left;opacity:.55;'>a</a><select><option>text</option></select>";

var all = div.getElementsByTagName("*"),
a = div.getElementsByTagName("a")[0];

1 comment on commit 3776cbe

@paulirish

This comment has been minimized.

Copy link
Member

@paulirish paulirish commented on 3776cbe Dec 24, 2009

Have to say I really appreciate this as one time I needed jQuery as a string and manually escaping all these was a pain.
Don't ask why I needed jQuery as a string.. :D

Please sign in to comment.
You can’t perform that action at this time.