[Pkg-javascript-commits] [dojo] 61/87: Fix tilde handling in acme, so it can be used in ids, refs #15319 !strict Backport to 1.7. Also fix incomplete backport of changeset [29124].
David Prévot
taffit at moszumanska.debian.org
Thu Aug 21 17:39:21 UTC 2014
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to annotated tag 1.7.5
in repository dojo.
commit 559d286a5ebcaf5f263544af01d2c8f05dfbb5e9
Author: Colin Snover <github.com at zetafleet.com>
Date: Fri Nov 23 23:33:50 2012 +0000
Fix tilde handling in acme, so it can be used in ids, refs #15319 !strict Backport to 1.7. Also fix incomplete backport of changeset [29124].
git-svn-id: http://svn.dojotoolkit.org/src/branches/1.7/dojo@30038 560b804f-0ae3-0310-86f3-f6aa0a117693
---
selector/acme.js | 2 +-
selector/lite.js | 33 ++++++++++++++++++++-------------
2 files changed, 21 insertions(+), 14 deletions(-)
diff --git a/selector/acme.js b/selector/acme.js
index 80d1a4f..b4eaa80 100644
--- a/selector/acme.js
+++ b/selector/acme.js
@@ -1115,7 +1115,7 @@ define(["../_base/kernel", "../has", "../dom", "../_base/sniff", "../_base/array
);
//Don't bother with n+3 type of matches, IE complains if we modify those.
- var infixSpaceRe = /n\+\d|([^ ])?([>~+])([^ =])?/g;
+ var infixSpaceRe = /\\[>~+]|n\+\d|([^ \\])?([>~+])([^ =])?/g;
var infixSpaceFunc = function(match, pre, ch, post){
return ch ? (pre ? pre + " " : "") + ch + (post ? " " + post : "") : /*n+3*/ match;
};
diff --git a/selector/lite.js b/selector/lite.js
index 55c149f..693a618 100644
--- a/selector/lite.js
+++ b/selector/lite.js
@@ -124,20 +124,27 @@ var useRoot = function(context, query, method){
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";
- function tag(tagName){
- tagName = tagName[caseFix]();
- return function(node){
- return node.tagName == tagName;
- }
- }
- function className(className){
- var classNameSpaced = ' ' + className + ' ';
- return function(node){
- return node.className.indexOf(className) > -1 && (' ' + node.className + ' ').indexOf(classNameSpaced) > -1;
+ // 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;
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/dojo.git
More information about the Pkg-javascript-commits
mailing list