Skip to content
This repository has been archived by the owner on Jun 14, 2020. It is now read-only.

Commit

Permalink
Enable strict mode, and fix global variable problems.
Browse files Browse the repository at this point in the history
  • Loading branch information
Craga89 committed Jul 11, 2013
1 parent 251b874 commit e253a01
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 10 deletions.
7 changes: 4 additions & 3 deletions src/core/class.js
Expand Up @@ -6,7 +6,7 @@ function QTip(target, options, id, attr) {
this.id = id;
this.target = target;
this.tooltip = NULL;
this.elements = elements = { target: target };
this.elements = { target: target };

// Internal constructs
this._id = NAMESPACE + '-' + id;
Expand All @@ -15,7 +15,7 @@ function QTip(target, options, id, attr) {
this.plugins = {};

// Cache object
this.cache = cache = {
this.cache = {
event: {},
target: $(),
disabled: FALSE,
Expand All @@ -42,7 +42,8 @@ PROTOTYPE.render = function(show) {
button = options.content.button,
posOptions = options.position,
namespace = '.'+this._id+' ',
deferreds = [];
deferreds = [],
tooltip;

// Add ARIA attributes to target
$.attr(this.target[0], 'aria-describedby', this._id);
Expand Down
2 changes: 1 addition & 1 deletion src/core/intro.js
Expand Up @@ -16,5 +16,5 @@
}
(function($) {
/* This currently causes issues with Safari 6, so for it's disabled */
//"use strict"; // (Dis)able ECMAScript "strict" operation for this function. See more: http://ejohn.org/blog/ecmascript-5-strict-mode-json-and-more/
"use strict"; // (Dis)able ECMAScript "strict" operation for this function. See more: http://ejohn.org/blog/ecmascript-5-strict-mode-json-and-more/

2 changes: 1 addition & 1 deletion src/core/toggle.js
Expand Up @@ -32,7 +32,7 @@ PROTOTYPE.toggle = function(state, event) {
visible = this.tooltip[0].offsetWidth > 0,
animate = state || opts.target.length === 1,
sameTarget = !event || opts.target.length < 2 || cache.target[0] === event.target,
identicalState, allow, showEvent, delay;
identicalState, allow, showEvent, delay, after;

// Detect state if valid one isn't provided
if((typeof state).search('boolean|number')) { state = !visible; }
Expand Down
10 changes: 5 additions & 5 deletions src/tips/tips.js
Expand Up @@ -140,7 +140,7 @@ $.extend(Tip.prototype, {
return (use ? intCss(use, prop) : (
intCss(elements.content, prop) ||
intCss(this._useTitle(corner) && elements.titlebar || elements.content, prop) ||
intCss(tooltip, prop)
intCss(elements.tooltip, prop)
)) || 0;
},

Expand All @@ -167,11 +167,11 @@ $.extend(Tip.prototype, {

// Attempt to detect the background colour from various elements, left-to-right precedance
color[0] = css(tip, BG_COLOR) || css(colorElem, BG_COLOR) || css(elements.content, BG_COLOR) ||
css(tooltip, BG_COLOR) || tip.css(BG_COLOR);
css(elements.tooltip, BG_COLOR) || tip.css(BG_COLOR);

// Attempt to detect the correct border side colour from various elements, left-to-right precedance
color[1] = css(tip, borderSide, COLOR) || css(colorElem, borderSide, COLOR) ||
css(elements.content, borderSide, COLOR) || css(tooltip, borderSide, COLOR) || tooltip.css(borderSide);
css(elements.content, borderSide, COLOR) || css(elements.tooltip, borderSide, COLOR) || elements.tooltip.css(borderSide);

// Reset background and border colours
$('*', tip).add(tip).css('cssText', BG_COLOR+':'+TRANSPARENT+IMPORTANT+';'+BORDER+':0'+IMPORTANT+';');
Expand Down Expand Up @@ -352,7 +352,7 @@ $.extend(Tip.prototype, {
if(border) {
// Make sure transparent borders are supported by doing a stroke
// of the background colour before the stroke colour
if(tooltip.css('background-clip') === 'border-box') {
if(elements.tooltip.css('background-clip') === 'border-box') {
context.strokeStyle = color[0];
context.stroke();
}
Expand Down Expand Up @@ -412,7 +412,7 @@ $.extend(Tip.prototype, {
elements = this.qtip.elements,
tip = this.element,
userOffset = this.options.offset,
isWidget = this.qtip.tooltip.hasClass('ui-widget'),
isWidget = elements.tooltip.hasClass('ui-widget'),
position = { },
precedance, size, corners;

Expand Down

0 comments on commit e253a01

Please sign in to comment.