summaryrefslogtreecommitdiff
path: root/macros/luatex/generic/luaxml/luaxml-cssquery.lua
diff options
context:
space:
mode:
Diffstat (limited to 'macros/luatex/generic/luaxml/luaxml-cssquery.lua')
-rw-r--r--macros/luatex/generic/luaxml/luaxml-cssquery.lua14
1 files changed, 13 insertions, 1 deletions
diff --git a/macros/luatex/generic/luaxml/luaxml-cssquery.lua b/macros/luatex/generic/luaxml/luaxml-cssquery.lua
index ebb29abb15..452656845c 100644
--- a/macros/luatex/generic/luaxml/luaxml-cssquery.lua
+++ b/macros/luatex/generic/luaxml/luaxml-cssquery.lua
@@ -156,7 +156,7 @@ local function cssquery()
-- make sure we deal with a string
value = tostring(value)
-- make the search string safe for pattern matching
- local escaped_search = search:gsub("([%(%)%.%%%+%–%*%?%[%^%$])", "%%%1")
+ local escaped_search = search:gsub("([%(%)%.%%%+%-%#%*%?%[%^%$])", "%%%1")
if modifier == "" then
return value == search
elseif modifier == "|" then
@@ -434,6 +434,18 @@ local function cssquery()
return querylist
end
+ --- Remove selector from the CSS list object.
+ -- All actions that literaly match the given selector will be removed.
+ function CssQuery:remove_selector(
+ selector -- CSS selector to be removed
+ )
+ for pos, obj in ipairs(self.querylist) do
+ if obj.source == selector then
+ table.remove(self.querylist, pos)
+ end
+ end
+ end
+
--- It tests list of queries agaings a DOM element and executes the
--- coresponding function that is saved for the matched query.
-- @return nothing