AdguardTeam / AdguardTeam/ExtendedCss

Add ability to remove 'text' node

オープン
#165 コメント 2 件 リアクション 0 件 担当者 1 名 @maximtop が担当を希望しています GitHub で見る
feature request Priority: P2 Version: ExtendedCss v2.2
主要言語
TypeScript
スター
71
フォーク
11
PR マージ指標
30日以内にマージされた PR はありません

説明

Related to - https://github.com/AdguardTeam/ExtendedCss/issues/106
Another issue when it could be useful - https://github.com/AdguardTeam/AdguardFilters/issues/146786
https://github.com/AdguardTeam/AdguardFilters/pull/146872


Test page - https://jsfiddle.net/yehz25L4/
Code:

```html





Document


Advertisement

Test


1234


qwerty



```

Rule which should remove text `Advertisement`:
```adblock
fiddle.jshell.net#$?#:xpath(//div[contains(@id,"test")]/text()[contains(.,'Advertisement')]) { remove: true; }
```

`ExtendedCss.query` which should match element:
```js
ExtendedCss.query(`:xpath(//div[contains(@id,"test")]/text()[contains(.,'Advertisement')])`)
```

I might be wrong, but I guess that it doesn't work currently, because `isHtmlElement`
https://github.com/AdguardTeam/ExtendedCss/blob/7d2957ffbf92c7f082a861276024e733fd0a8477/src/common/utils/nodes.ts#L87-L89
returns `false` for `text` node and probably due to this, element is not matched.

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。