From 4c6ee1e0d3f9e636708c4200c8d15c60b9809bcc Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Tue, 4 Aug 2020 11:30:04 -0400 Subject: [PATCH] Fix broken `:spath` operators starting with `>` Related feedback: - https://github.com/gorhill/uBlock/commit/7dd48a6c8c4d9153b4bc3f56904f3abfb5b23512#r41180568 Regression from: - https://github.com/gorhill/uBlock/commit/7dd48a6c8c4d9153b4bc3f56904f3abfb5b23512 --- src/js/contentscript.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/js/contentscript.js b/src/js/contentscript.js index da8e4c7aa..05422e690 100644 --- a/src/js/contentscript.js +++ b/src/js/contentscript.js @@ -574,6 +574,10 @@ vAPI.injectScriptlet = function(doc, text) { constructor(task) { this.spath = task[1]; this.nth = /^(?:\s*[+~]|:)/.test(this.spath); + if ( this.nth ) { return; } + if ( /^\s*>/.test(this.spath) ) { + this.spath = `:scope ${this.spath.trim()}`; + } } qsa(node) { if ( this.nth === false ) {