Got an issue on working ctools with the others external script, which extends Array object. For example:
Array.prototype.contains=function(obj) {
for(var i=0; i<this.length; i++) {
if(this[i] === obj) return i;
}
return -1;
};
the problem is with
Drupal.CTools.AJAX.commands.scripts = function(data) {
...
for (i in data.argument) {
we are processing an array as an object and as the result it have "function contains()" in values, when it passed to Drupal.CTools.AJAX.getPath it breaks javascript when it tries get indexOf('?') from function.
there are two possible solutions how to fix it:
1. add validation of value in Drupal.CTools.AJAX.getPath
2. replace for ... in with for loop
both of the fixes added to patch.
Comments
Comment #1
andypostfor..in iteration should be used only for Objects!!!
This is over-engineering
same should be applied for css!
Comment #2
gumanist commentedRemoved redundant validation for link, updated iterator for css.
Comment #3
nod_Please be careful of implicit global variables, add
varto variables declaration,for (var i = 0....Comment #4
gumanist commentedThanks for your suggession. You are totally right. Patch updated.
Comment #5
yarroha commentedWorks fine for me.
Comment #6
andypostMakes sense and now looks good
Comment #7
merlinofchaos commentedCommitted and pushed.