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

Commit

Permalink
.set() no longer requires tooltip to be rendered. Fixed hide/show .se…
Browse files Browse the repository at this point in the history
…t() calls
  • Loading branch information
Craga89 committed Apr 8, 2011
1 parent d2a0297 commit 1ab8137
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 40 deletions.
2 changes: 1 addition & 1 deletion dist/jquery.qtip.css
Expand Up @@ -9,7 +9,7 @@
* http://en.wikipedia.org/wiki/MIT_License
* http://en.wikipedia.org/wiki/GNU_General_Public_License
*
* Date: Thu Apr 7 20:07:06 2011 +0100
* Date: Fri Apr 8 15:54:19 2011 +0100
*/

/* Fluid class for determining actual width in IE */
Expand Down
31 changes: 13 additions & 18 deletions dist/jquery.qtip.js
Expand Up @@ -9,7 +9,7 @@
* http://en.wikipedia.org/wiki/MIT_License
* http://en.wikipedia.org/wiki/GNU_General_Public_License
*
* Date: Thu Apr 7 20:07:06 2011 +0100
* Date: Fri Apr 8 15:54:19 2011 +0100
*/

"use strict"; // Enable ECMAScript "strict" operation for this function. See more: http://ejohn.org/blog/ecmascript-5-strict-mode-json-and-more/
Expand Down Expand Up @@ -639,12 +639,15 @@ function QTip(target, options, id, attr)
'^(show|hide).(event|target|fixed|delay|inactive)$': function(obj, o, v, p, match) {
// Setup arguments
var args = [1,0,0];
args[match[0] === 'show' ? 'push' : 'unshift'](0);
args[match[1] === 'show' ? 'push' : 'unshift'](0);

unassignEvents.apply(self, args);
assignEvents.apply(self, [1,1,0,0]);
},
'^show.ready$': function() { if(!self.rendered) { self.show(); } },
'^show.ready$': function() {
if(!self.rendered) { self.render(1); }
else { self.show(); }
},

// Style checks
'^style.classes$': function(obj, o, v) {
Expand Down Expand Up @@ -782,30 +785,22 @@ function QTip(target, options, id, attr)

set: function(option, value)
{
var rmove = /^position.(my|at|adjust|target|container)|style|content/i,
var rmove = /^position\.(my|at|adjust|target|container)|style|content|show\.ready/i,
reposition = FALSE,
checks = self.checks,
name;

function callback(notation, args) {
var category, rule, match;

if(self.rendered) {
for(category in checks) {
for(rule in checks[category]) {
if(match = (new RegExp(rule, 'i')).exec(notation)) {
args.push(match);
checks[category][rule].apply(self, args);
}
for(category in checks) {
for(rule in checks[category]) {
if(match = (new RegExp(rule, 'i')).exec(notation)) {
args.push(match);
checks[category][rule].apply(self, args);
}
}
}

// If we're not rendered and show.ready was set, render it
else if(notation === 'show.ready' && args[2]) {
isPositioning = 0; isDrawing = 0;
self.render(TRUE);
}
}

// Convert singular option/value pair into object form
Expand All @@ -817,7 +812,7 @@ function QTip(target, options, id, attr)
// Set all of the defined options to their new values
$.each(option, function(notation, value) {
var obj = convertNotation( notation.toLowerCase() ), previous;

// Set new obj value
previous = obj[0][ obj[1] ];
obj[0][ obj[1] ] = 'object' === typeof value && value.nodeType ? $(value) : value;
Expand Down
4 changes: 2 additions & 2 deletions dist/jquery.qtip.min.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/jquery.qtip.pack.js

Large diffs are not rendered by default.

29 changes: 12 additions & 17 deletions src/core.js
Expand Up @@ -597,12 +597,15 @@ function QTip(target, options, id, attr)
'^(show|hide).(event|target|fixed|delay|inactive)$': function(obj, o, v, p, match) {
// Setup arguments
var args = [1,0,0];
args[match[0] === 'show' ? 'push' : 'unshift'](0);
args[match[1] === 'show' ? 'push' : 'unshift'](0);

unassignEvents.apply(self, args);
assignEvents.apply(self, [1,1,0,0]);
},
'^show.ready$': function() { if(!self.rendered) { self.show(); } },
'^show.ready$': function() {
if(!self.rendered) { self.render(1); }
else { self.show(); }
},

// Style checks
'^style.classes$': function(obj, o, v) {
Expand Down Expand Up @@ -740,30 +743,22 @@ function QTip(target, options, id, attr)

set: function(option, value)
{
var rmove = /^position.(my|at|adjust|target|container)|style|content/i,
var rmove = /^position\.(my|at|adjust|target|container)|style|content|show\.ready/i,
reposition = FALSE,
checks = self.checks,
name;

function callback(notation, args) {
var category, rule, match;

if(self.rendered) {
for(category in checks) {
for(rule in checks[category]) {
if(match = (new RegExp(rule, 'i')).exec(notation)) {
args.push(match);
checks[category][rule].apply(self, args);
}
for(category in checks) {
for(rule in checks[category]) {
if(match = (new RegExp(rule, 'i')).exec(notation)) {
args.push(match);
checks[category][rule].apply(self, args);
}
}
}

// If we're not rendered and show.ready was set, render it
else if(notation === 'show.ready' && args[2]) {
isPositioning = 0; isDrawing = 0;
self.render(TRUE);
}
}

// Convert singular option/value pair into object form
Expand All @@ -775,7 +770,7 @@ function QTip(target, options, id, attr)
// Set all of the defined options to their new values
$.each(option, function(notation, value) {
var obj = convertNotation( notation.toLowerCase() ), previous;

// Set new obj value
previous = obj[0][ obj[1] ];
obj[0][ obj[1] ] = 'object' === typeof value && value.nodeType ? $(value) : value;
Expand Down

0 comments on commit 1ab8137

Please sign in to comment.