Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

switching to the correct method for resetting a regex pointer

  • Loading branch information...
commit d93dde9038b3bdf9a98c5648f33451761b9d6e51 1 parent fb39a3e
@heygrady authored
Showing with 10 additions and 8 deletions.
  1. +10 −8 lib/jquery.transform.js
View
18 lib/jquery.transform.js
@@ -322,8 +322,7 @@
args = $.isArray(funcs[func]) ? funcs[func] : [funcs[func]];
this[func].apply(this, args);
}
- }
-
+ }
// calculate translation
// NOTE: Translate is additive
@@ -432,6 +431,7 @@
} else {
this.setAttr('origin', [x, y]);
}
+ console.log(x, y);
return true;
},
@@ -500,6 +500,7 @@
// now we need to fix it!
var calc = new $.matrix.calc(matrix, this.safeOuterHeight(), this.safeOuterWidth()),
origin = this.getAttr('origin');
+ console.log(origin);
// translate a 0, 0 origin to the current origin
var offset = calc.originOffset({
@@ -760,13 +761,13 @@
var values = [],
result, parts;
- rfuncvalue.exec(''); // hacky, reset the regex pointer
+ rfuncvalue.lastIndex = 0; //reset the regex pointer
while ((result = rfuncvalue.exec(transform)) !== null) {
values.push(result[0]);
}
for (var i = 0, l = values.length; i < l; i++) {
- rfuncvalue.exec(''); // hacky, reset the regex pointer
+ rfuncvalue.lastIndex = 0; //reset the regex pointer
parts = rfuncvalue.exec(values[i]);
if (func == parts[1]) {
@@ -793,13 +794,13 @@
attrs = {},
result, parts, value;
- rfuncvalue.exec(''); // hacky, reset the regex pointer
+ rfuncvalue.lastIndex = 0; //reset the regex pointer
while ((result = rfuncvalue.exec(transform)) !== null) {
values.push(result[0]);
}
for (var i = 0, l = values.length; i < l; i++) {
- rfuncvalue.exec(''); // hacky, reset the regex pointer
+ rfuncvalue.lastIndex = 0; //reset the regex pointer
parts = rfuncvalue.exec(values[i]);
if (parts && rfuncname.test(parts[1])) {
@@ -822,6 +823,7 @@
}
var transform = this.attr || this.$elem.attr(attr);
+ console.log(transform);
var rscalefunc = $.transform.rfunc.scale;
if (func != 'origin' && func != 'matrix' && (!transform || transform.indexOf(func) === -1)) {
// We don't have any existing values, return null
@@ -831,13 +833,13 @@
// return the existing value
var values = [],
result, parts, value = null;
- rfuncvalue.exec(''); // hacky, reset the regex pointer
+ rfuncvalue.lastIndex = 0; //reset the regex pointer
while ((result = rfuncvalue.exec(transform)) !== null) {
values.push(result[0]);
}
for (var i = 0, l = values.length; i < l; i++) {
- rfuncvalue.exec(''); // hacky, reset the regex pointer
+ rfuncvalue.lastIndex = 0; //reset the regex pointer
parts = rfuncvalue.exec(values[i]);
if (func == parts[1]) {
Please sign in to comment.
Something went wrong with that request. Please try again.