[Pkg-mozext-commits] [adblock-plus-element-hiding-helper] 14/483: Fixing selector escaping issues and supporting empty attributes
David Prévot
taffit at moszumanska.debian.org
Thu Jan 22 21:41:22 UTC 2015
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository adblock-plus-element-hiding-helper.
commit 666bdb31061ca8b33fde1f22e059c649eac4af47
Author: Wladimir Palant <trev at gtchat.de>
Date: Tue Jan 9 13:06:32 2007 +0000
Fixing selector escaping issues and supporting empty attributes
--HG--
extra : convert_revision : svn%3Ad8bf93c1-8190-44a8-bb31-1ea94378a4df/trunk%40611
---
chrome/content/composer.js | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/chrome/content/composer.js b/chrome/content/composer.js
index 22ae484..e5078b5 100644
--- a/chrome/content/composer.js
+++ b/chrome/content/composer.js
@@ -42,6 +42,11 @@ function NodeData(node, parentNode) {
this.attributes = [];
for (var i = 0; i < node.attributes.length; i++) {
var attribute = node.attributes[i];
+
+ // Ignore attribute names containing { or } - limitation of ABP
+ if (/[{}]/.test(attribute.name))
+ continue;
+
var data = {name: attribute.name, value: attribute.value, selected: attribute.value, checked: false};
if (data.name == "id" || data.name == "class")
this.attributes.unshift(data);
@@ -119,12 +124,16 @@ function updateExpression() {
else if (attr.value.substr(attr.value.length - attr.selected.length) == attr.selected)
op = "$=";
- if (/[()"]/.test(attr.value))
+ if (/[^\w\-]/.test(attr.name) || /[()"]/.test(attr.value))
expressionSimple = null;
if (expressionSimple != null)
expressionSimple += "(" + attr.name + op + attr.value + ")";
- expressionRaw += "[" + attr.name + op + '"' + attr.value.replace(/"/g, '\\"') + '"' + "]";
+ expressionRaw += "[" + attr.name.replace(/([^\w\-])/g, "\\$1") + op + '"' + attr.value.replace(/"/g, '\\"') + '"' + "]";
+ }
+ else if (attr.checked) {
+ expressionSimple = null;
+ expressionRaw += "[" + attr.name.replace(/([^\w\-])/g, "\\$1") + "]";
}
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/adblock-plus-element-hiding-helper.git
More information about the Pkg-mozext-commits
mailing list