1
0
mirror of https://git.tt-rss.org/git/tt-rss.git synced 2026-02-10 16:01:33 +00:00

upgrade dojo to 1.8.3 (refs #570)

This commit is contained in:
Andrew Dolgov
2013-03-18 10:26:24 +04:00
parent 9a2885da17
commit f0cfe83e37
1568 changed files with 159866 additions and 2781 deletions
+1 -1
View File
@@ -1,5 +1,5 @@
/*
Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
Copyright (c) 2004-2012, The Dojo Foundation All Rights Reserved.
Available via Academic Free License >= 2.1 OR the modified BSD license.
see: http://dojotoolkit.org/license for details
*/
@@ -0,0 +1,47 @@
define("dojo/selector/_loader", ["../has", "require"],
function(has, require){
"use strict";
var testDiv = document.createElement("div");
has.add("dom-qsa2.1", !!testDiv.querySelectorAll);
has.add("dom-qsa3", function(){
// test to see if we have a reasonable native selector engine available
try{
testDiv.innerHTML = "<p class='TEST'></p>"; // test kind of from sizzle
// Safari can't handle uppercase or unicode characters when
// in quirks mode, IE8 can't handle pseudos like :empty
return testDiv.querySelectorAll(".TEST:empty").length == 1;
}catch(e){}
});
var fullEngine;
var acme = "./acme", lite = "./lite";
return {
// summary:
// This module handles loading the appropriate selector engine for the given browser
load: function(id, parentRequire, loaded, config){
var req = require;
// here we implement the default logic for choosing a selector engine
id = id == "default" ? has("config-selectorEngine") || "css3" : id;
id = id == "css2" || id == "lite" ? lite :
id == "css2.1" ? has("dom-qsa2.1") ? lite : acme :
id == "css3" ? has("dom-qsa3") ? lite : acme :
id == "acme" ? acme : (req = parentRequire) && id;
if(id.charAt(id.length-1) == '?'){
id = id.substring(0,id.length - 1);
var optionalLoad = true;
}
// the query engine is optional, only load it if a native one is not available or existing one has not been loaded
if(optionalLoad && (has("dom-compliant-qsa") || fullEngine)){
return loaded(fullEngine);
}
// load the referenced selector engine
req([id], function(engine){
if(id != "./lite"){
fullEngine = engine;
}
loaded(engine);
});
}
};
});
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -1,8 +1,8 @@
/*
Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
Copyright (c) 2004-2012, The Dojo Foundation All Rights Reserved.
Available via Academic Free License >= 2.1 OR the modified BSD license.
see: http://dojotoolkit.org/license for details
*/
//>>built
define("dojo/selector/lite",["../has","../_base/kernel"],function(_1,_2){"use strict";var _3=document.createElement("div");var _4=_3.matchesSelector||_3.webkitMatchesSelector||_3.mozMatchesSelector||_3.msMatchesSelector||_3.oMatchesSelector;var _5=_3.querySelectorAll;_1.add("dom-matches-selector",!!_4);_1.add("dom-qsa",!!_5);var _6=function(_7,_8){if(_9&&_7.indexOf(",")>-1){return _9(_7,_8);}var _a=(_5?/^([\w]*)#([\w\-]+$)|^(\.)([\w\-\*]+$)|^(\w+$)/:/^([\w]*)#([\w\-]+)(?:\s+(.*))?$|(?:^|(>|.+\s+))([\w\-\*]+)(\S*$)/).exec(_7);_8=_8||document;if(_a){if(_a[2]){var _b=_2.byId?_2.byId(_a[2]):document.getElementById(_a[2]);if(!_b||(_a[1]&&_a[1]!=_b.tagName.toLowerCase())){return [];}if(_8!=document){var _c=_b;while(_c!=_8){_c=_c.parentNode;if(!_c){return [];}}}return _a[3]?_6(_a[3],_b):[_b];}if(_a[3]&&_8.getElementsByClassName){return _8.getElementsByClassName(_a[4]);}var _b;if(_a[5]){_b=_8.getElementsByTagName(_a[5]);if(_a[4]||_a[6]){_7=(_a[4]||"")+_a[6];}else{return _b;}}}if(_5){if(_8.nodeType===1&&_8.nodeName.toLowerCase()!=="object"){return _d(_8,_7,_8.querySelectorAll);}else{return _8.querySelectorAll(_7);}}else{if(!_b){_b=_8.getElementsByTagName("*");}}var _e=[];for(var i=0,l=_b.length;i<l;i++){var _f=_b[i];if(_f.nodeType==1&&_10(_f,_7,_8)){_e.push(_f);}}return _e;};var _d=function(_11,_12,_13){var _14=_11,old=_11.getAttribute("id"),nid=old||"__dojo__",_15=_11.parentNode,_16=/^\s*[+~]/.test(_12);if(_16&&!_15){return [];}if(!old){_11.setAttribute("id",nid);}else{nid=nid.replace(/'/g,"\\$&");}if(_16&&_15){_11=_11.parentNode;}try{return _13.call(_11,"[id='"+nid+"'] "+_12);}finally{if(!old){_14.removeAttribute("id");}}};if(!_1("dom-matches-selector")){var _10=(function(){var _17=_3.tagName=="div"?"toLowerCase":"toUpperCase";function tag(_18){_18=_18[_17]();return function(_19){return _19.tagName==_18;};};function _1a(_1b){var _1c=" "+_1b+" ";return function(_1d){return _1d.className.indexOf(_1b)>-1&&(" "+_1d.className+" ").indexOf(_1c)>-1;};};var _1e={"^=":function(_1f,_20){return _1f.indexOf(_20)==0;},"*=":function(_21,_22){return _21.indexOf(_22)>-1;},"$=":function(_23,_24){return _23.substring(_23.length-_24.length,_23.length)==_24;},"~=":function(_25,_26){return (" "+_25+" ").indexOf(" "+_26+" ")>-1;},"|=":function(_27,_28){return (_27+"-").indexOf(_28+"-")==0;},"=":function(_29,_2a){return _29==_2a;},"":function(_2b,_2c){return true;}};function _2d(_2e,_2f,_30){if(_2f.match(/['"]/)){_2f=eval(_2f);}var _31=_1e[_30||""];return function(_32){var _33=_32.getAttribute(_2e);return _33&&_31(_33,_2f);};};function _34(_35){return function(_36,_37){while((_36=_36.parentNode)!=_37){if(_35(_36,_37)){return true;}}};};function _38(_39){return function(_3a,_3b){_3a=_3a.parentNode;return _39?_3a!=_3b&&_39(_3a,_3b):_3a==_3b;};};var _3c={};function and(_3d,_3e){return _3d?function(_3f,_40){return _3e(_3f)&&_3d(_3f,_40);}:_3e;};return function(_41,_42,_43){var _44=_3c[_42];if(!_44){if(_42.replace(/(?:\s*([> ])\s*)|(\.)?([\w-]+)|\[([\w-]+)\s*(.?=)?\s*([^\]]*)\]/g,function(t,_45,_46,_47,_48,_49,_4a){if(_47){if(_46=="."){_44=and(_44,_1a(_47));}else{_44=and(_44,tag(_47));}}else{if(_45){_44=(_45==" "?_34:_38)(_44);}else{if(_48){_44=and(_44,_2d(_48,_4a,_49));}}}return "";})){throw new Error("Syntax error in query");}if(!_44){return true;}_3c[_42]=_44;}return _44(_41,_43);};})();}if(!_1("dom-qsa")){var _9=function(_4b,_4c){_4b=_4b.split(/\s*,\s*/);var _4d=[];for(var i=0;i<_4b.length;i++){var _4e=_6(_4b[i],_4c);for(var j=0,l=_4e.length;j<l;j++){var _4f=_4e[j];_4d[_4f.sourceIndex]=_4f;}}var _50=[];for(i in _4d){_50.push(_4d[i]);}return _50;};}_6.match=_4?function(_51,_52,_53){if(_53){return _d(_53,_52,function(_54){return _4.call(_51,_54);});}return _4.call(_51,_52);}:_10;return _6;});
define("dojo/selector/lite",["../has","../_base/kernel"],function(_1,_2){"use strict";var _3=document.createElement("div");var _4=_3.matchesSelector||_3.webkitMatchesSelector||_3.mozMatchesSelector||_3.msMatchesSelector||_3.oMatchesSelector;var _5=_3.querySelectorAll;var _6=/([^\s,](?:"(?:\\.|[^"])+"|'(?:\\.|[^'])+'|[^,])*)/g;_1.add("dom-matches-selector",!!_4);_1.add("dom-qsa",!!_5);var _7=function(_8,_9){if(_a&&_8.indexOf(",")>-1){return _a(_8,_9);}var _b=_9?_9.ownerDocument||_9:_2.doc||document,_c=(_5?/^([\w]*)#([\w\-]+$)|^(\.)([\w\-\*]+$)|^(\w+$)/:/^([\w]*)#([\w\-]+)(?:\s+(.*))?$|(?:^|(>|.+\s+))([\w\-\*]+)(\S*$)/).exec(_8);_9=_9||_b;if(_c){if(_c[2]){var _d=_2.byId?_2.byId(_c[2]):_b.getElementById(_c[2]);if(!_d||(_c[1]&&_c[1]!=_d.tagName.toLowerCase())){return [];}if(_9!=_b){var _e=_d;while(_e!=_9){_e=_e.parentNode;if(!_e){return [];}}}return _c[3]?_7(_c[3],_d):[_d];}if(_c[3]&&_9.getElementsByClassName){return _9.getElementsByClassName(_c[4]);}var _d;if(_c[5]){_d=_9.getElementsByTagName(_c[5]);if(_c[4]||_c[6]){_8=(_c[4]||"")+_c[6];}else{return _d;}}}if(_5){if(_9.nodeType===1&&_9.nodeName.toLowerCase()!=="object"){return _f(_9,_8,_9.querySelectorAll);}else{return _9.querySelectorAll(_8);}}else{if(!_d){_d=_9.getElementsByTagName("*");}}var _10=[];for(var i=0,l=_d.length;i<l;i++){var _11=_d[i];if(_11.nodeType==1&&_12(_11,_8,_9)){_10.push(_11);}}return _10;};var _f=function(_13,_14,_15){var _16=_13,old=_13.getAttribute("id"),nid=old||"__dojo__",_17=_13.parentNode,_18=/^\s*[+~]/.test(_14);if(_18&&!_17){return [];}if(!old){_13.setAttribute("id",nid);}else{nid=nid.replace(/'/g,"\\$&");}if(_18&&_17){_13=_13.parentNode;}var _19=_14.match(_6);for(var i=0;i<_19.length;i++){_19[i]="[id='"+nid+"'] "+_19[i];}_14=_19.join(",");try{return _15.call(_13,_14);}finally{if(!old){_16.removeAttribute("id");}}};if(!_1("dom-matches-selector")){var _12=(function(){var _1a=_3.tagName=="div"?"toLowerCase":"toUpperCase";var _1b={"":function(_1c){_1c=_1c[_1a]();return function(_1d){return _1d.tagName==_1c;};},".":function(_1e){var _1f=" "+_1e+" ";return function(_20){return _20.className.indexOf(_1e)>-1&&(" "+_20.className+" ").indexOf(_1f)>-1;};},"#":function(id){return function(_21){return _21.id==id;};}};var _22={"^=":function(_23,_24){return _23.indexOf(_24)==0;},"*=":function(_25,_26){return _25.indexOf(_26)>-1;},"$=":function(_27,_28){return _27.substring(_27.length-_28.length,_27.length)==_28;},"~=":function(_29,_2a){return (" "+_29+" ").indexOf(" "+_2a+" ")>-1;},"|=":function(_2b,_2c){return (_2b+"-").indexOf(_2c+"-")==0;},"=":function(_2d,_2e){return _2d==_2e;},"":function(_2f,_30){return true;}};function _31(_32,_33,_34){var _35=_33.charAt(0);if(_35=="\""||_35=="'"){_33=_33.slice(1,-1);}_33=_33.replace(/\\/g,"");var _36=_22[_34||""];return function(_37){var _38=_37.getAttribute(_32);return _38&&_36(_38,_33);};};function _39(_3a){return function(_3b,_3c){while((_3b=_3b.parentNode)!=_3c){if(_3a(_3b,_3c)){return true;}}};};function _3d(_3e){return function(_3f,_40){_3f=_3f.parentNode;return _3e?_3f!=_40&&_3e(_3f,_40):_3f==_40;};};var _41={};function and(_42,_43){return _42?function(_44,_45){return _43(_44)&&_42(_44,_45);}:_43;};return function(_46,_47,_48){var _49=_41[_47];if(!_49){if(_47.replace(/(?:\s*([> ])\s*)|(#|\.)?((?:\\.|[\w-])+)|\[\s*([\w-]+)\s*(.?=)?\s*("(?:\\.|[^"])+"|'(?:\\.|[^'])+'|(?:\\.|[^\]])*)\s*\]/g,function(t,_4a,_4b,_4c,_4d,_4e,_4f){if(_4c){_49=and(_49,_1b[_4b||""](_4c.replace(/\\/g,"")));}else{if(_4a){_49=(_4a==" "?_39:_3d)(_49);}else{if(_4d){_49=and(_49,_31(_4d,_4f,_4e));}}}return "";})){throw new Error("Syntax error in query");}if(!_49){return true;}_41[_47]=_49;}return _49(_46,_48);};})();}if(!_1("dom-qsa")){var _a=function(_50,_51){var _52=_50.match(_6);var _53=[];for(var i=0;i<_52.length;i++){_50=new String(_52[i].replace(/\s*$/,""));_50.indexOf=escape;var _54=_7(_50,_51);for(var j=0,l=_54.length;j<l;j++){var _55=_54[j];_53[_55.sourceIndex]=_55;}}var _56=[];for(i in _53){_56.push(_53[i]);}return _56;};}_7.match=_4?function(_57,_58,_59){if(_59&&_59.nodeType!=9){return _f(_59,_58,function(_5a){return _4.call(_57,_5a);});}return _4.call(_57,_58);}:_12;return _7;});
+283
View File
@@ -0,0 +1,283 @@
define("dojo/selector/lite", ["../has", "../_base/kernel"], function(has, dojo){
"use strict";
var testDiv = document.createElement("div");
var matchesSelector = testDiv.matchesSelector || testDiv.webkitMatchesSelector || testDiv.mozMatchesSelector || testDiv.msMatchesSelector || testDiv.oMatchesSelector; // IE9, WebKit, Firefox have this, but not Opera yet
var querySelectorAll = testDiv.querySelectorAll;
var unionSplit = /([^\s,](?:"(?:\\.|[^"])+"|'(?:\\.|[^'])+'|[^,])*)/g;
has.add("dom-matches-selector", !!matchesSelector);
has.add("dom-qsa", !!querySelectorAll);
// this is a simple query engine. It has handles basic selectors, and for simple
// common selectors is extremely fast
var liteEngine = function(selector, root){
// summary:
// A small lightweight query selector engine that implements CSS2.1 selectors
// minus pseudo-classes and the sibling combinator, plus CSS3 attribute selectors
if(combine && selector.indexOf(',') > -1){
return combine(selector, root);
}
// use the root's ownerDocument if provided, otherwise try to use dojo.doc. Note
// that we don't use dojo/_base/window's doc to reduce dependencies, and
// fallback to plain document if dojo.doc hasn't been defined (by dojo/_base/window).
// presumably we will have a better way to do this in 2.0
var doc = root ? root.ownerDocument || root : dojo.doc || document,
match = (querySelectorAll ?
/^([\w]*)#([\w\-]+$)|^(\.)([\w\-\*]+$)|^(\w+$)/ : // this one only matches on simple queries where we can beat qSA with specific methods
/^([\w]*)#([\w\-]+)(?:\s+(.*))?$|(?:^|(>|.+\s+))([\w\-\*]+)(\S*$)/) // this one matches parts of the query that we can use to speed up manual filtering
.exec(selector);
root = root || doc;
if(match){
// fast path regardless of whether or not querySelectorAll exists
if(match[2]){
// an #id
// use dojo.byId if available as it fixes the id retrieval in IE, note that we can't use the dojo namespace in 2.0, but if there is a conditional module use, we will use that
var found = dojo.byId ? dojo.byId(match[2]) : doc.getElementById(match[2]);
if(!found || (match[1] && match[1] != found.tagName.toLowerCase())){
// if there is a tag qualifer and it doesn't match, no matches
return [];
}
if(root != doc){
// there is a root element, make sure we are a child of it
var parent = found;
while(parent != root){
parent = parent.parentNode;
if(!parent){
return [];
}
}
}
return match[3] ?
liteEngine(match[3], found)
: [found];
}
if(match[3] && root.getElementsByClassName){
// a .class
return root.getElementsByClassName(match[4]);
}
var found;
if(match[5]){
// a tag
found = root.getElementsByTagName(match[5]);
if(match[4] || match[6]){
selector = (match[4] || "") + match[6];
}else{
// that was the entirety of the query, return results
return found;
}
}
}
if(querySelectorAll){
// qSA works strangely on Element-rooted queries
// We can work around this by specifying an extra ID on the root
// and working up from there (Thanks to Andrew Dupont for the technique)
// IE 8 doesn't work on object elements
if (root.nodeType === 1 && root.nodeName.toLowerCase() !== "object"){
return useRoot(root, selector, root.querySelectorAll);
}else{
// we can use the native qSA
return root.querySelectorAll(selector);
}
}else if(!found){
// search all children and then filter
found = root.getElementsByTagName("*");
}
// now we filter the nodes that were found using the matchesSelector
var results = [];
for(var i = 0, l = found.length; i < l; i++){
var node = found[i];
if(node.nodeType == 1 && jsMatchesSelector(node, selector, root)){
// keep the nodes that match the selector
results.push(node);
}
}
return results;
};
var useRoot = function(context, query, method){
// this function creates a temporary id so we can do rooted qSA queries, this is taken from sizzle
var oldContext = context,
old = context.getAttribute("id"),
nid = old || "__dojo__",
hasParent = context.parentNode,
relativeHierarchySelector = /^\s*[+~]/.test(query);
if(relativeHierarchySelector && !hasParent){
return [];
}
if(!old){
context.setAttribute("id", nid);
}else{
nid = nid.replace(/'/g, "\\$&");
}
if(relativeHierarchySelector && hasParent){
context = context.parentNode;
}
var selectors = query.match(unionSplit);
for(var i = 0; i < selectors.length; i++){
selectors[i] = "[id='" + nid + "'] " + selectors[i];
}
query = selectors.join(",");
try{
return method.call(context, query);
}finally{
if(!old){
oldContext.removeAttribute("id");
}
}
};
if(!has("dom-matches-selector")){
var jsMatchesSelector = (function(){
// a JS implementation of CSS selector matching, first we start with the various handlers
var caseFix = testDiv.tagName == "div" ? "toLowerCase" : "toUpperCase";
var selectorTypes = {
"": function(tagName){
tagName = tagName[caseFix]();
return function(node){
return node.tagName == tagName;
};
},
".": function(className){
var classNameSpaced = ' ' + className + ' ';
return function(node){
return node.className.indexOf(className) > -1 && (' ' + node.className + ' ').indexOf(classNameSpaced) > -1;
};
},
"#": function(id){
return function(node){
return node.id == id;
};
}
};
var attrComparators = {
"^=": function(attrValue, value){
return attrValue.indexOf(value) == 0;
},
"*=": function(attrValue, value){
return attrValue.indexOf(value) > -1;
},
"$=": function(attrValue, value){
return attrValue.substring(attrValue.length - value.length, attrValue.length) == value;
},
"~=": function(attrValue, value){
return (' ' + attrValue + ' ').indexOf(' ' + value + ' ') > -1;
},
"|=": function(attrValue, value){
return (attrValue + '-').indexOf(value + '-') == 0;
},
"=": function(attrValue, value){
return attrValue == value;
},
"": function(attrValue, value){
return true;
}
};
function attr(name, value, type){
var firstChar = value.charAt(0);
if(firstChar == '"' || firstChar == "'"){
// it is quoted, remove the quotes
value = value.slice(1, -1);
}
value = value.replace(/\\/g,'');
var comparator = attrComparators[type || ""];
return function(node){
var attrValue = node.getAttribute(name);
return attrValue && comparator(attrValue, value);
};
}
function ancestor(matcher){
return function(node, root){
while((node = node.parentNode) != root){
if(matcher(node, root)){
return true;
}
}
};
}
function parent(matcher){
return function(node, root){
node = node.parentNode;
return matcher ?
node != root && matcher(node, root)
: node == root;
};
}
var cache = {};
function and(matcher, next){
return matcher ?
function(node, root){
return next(node) && matcher(node, root);
}
: next;
}
return function(node, selector, root){
// this returns true or false based on if the node matches the selector (optionally within the given root)
var matcher = cache[selector]; // check to see if we have created a matcher function for the given selector
if(!matcher){
// create a matcher function for the given selector
// parse the selectors
if(selector.replace(/(?:\s*([> ])\s*)|(#|\.)?((?:\\.|[\w-])+)|\[\s*([\w-]+)\s*(.?=)?\s*("(?:\\.|[^"])+"|'(?:\\.|[^'])+'|(?:\\.|[^\]])*)\s*\]/g, function(t, combinator, type, value, attrName, attrType, attrValue){
if(value){
matcher = and(matcher, selectorTypes[type || ""](value.replace(/\\/g, '')));
}
else if(combinator){
matcher = (combinator == " " ? ancestor : parent)(matcher);
}
else if(attrName){
matcher = and(matcher, attr(attrName, attrValue, attrType));
}
return "";
})){
throw new Error("Syntax error in query");
}
if(!matcher){
return true;
}
cache[selector] = matcher;
}
// now run the matcher function on the node
return matcher(node, root);
};
})();
}
if(!has("dom-qsa")){
var combine = function(selector, root){
// combined queries
var selectors = selector.match(unionSplit);
var indexed = [];
// add all results and keep unique ones, this only runs in IE, so we take advantage
// of known IE features, particularly sourceIndex which is unique and allows us to
// order the results
for(var i = 0; i < selectors.length; i++){
selector = new String(selectors[i].replace(/\s*$/,''));
selector.indexOf = escape; // keep it from recursively entering combine
var results = liteEngine(selector, root);
for(var j = 0, l = results.length; j < l; j++){
var node = results[j];
indexed[node.sourceIndex] = node;
}
}
// now convert from a sparse array to a dense array
var totalResults = [];
for(i in indexed){
totalResults.push(indexed[i]);
}
return totalResults;
};
}
liteEngine.match = matchesSelector ? function(node, selector, root){
if(root && root.nodeType != 9){
// doesn't support three args, use rooted id trick
return useRoot(root, selector, function(query){
return matchesSelector.call(node, query);
});
}
// we have a native matchesSelector, use that
return matchesSelector.call(node, selector);
} : jsMatchesSelector; // otherwise use the JS matches impl
return liteEngine;
});