PT-Plugin-Plus icon indicating copy to clipboard operation
PT-Plugin-Plus copied to clipboard

fix(hhanclub): remove "[新]" in title when getting search results

Open ixff opened this issue 1 year ago • 1 comments

ixff avatar Oct 19 '24 17:10 ixff

感觉这个改法不是很安全。代码要是变了,就会直接报错了

fzlins avatar Oct 20 '24 12:10 fzlins

感觉这个改法不是很安全。代码要是变了,就会直接报错了

“代码变了”你指的是网站哪部分代码变了? “报错”是因为啥?

ixff avatar Oct 20 '24 13:10 ixff

如果网站修改代码,find找不到元素,直接remove的话代码就会报错吧。 可以参考这贴里的方法:https://stackoverflow.com/questions/3442394/using-text-to-retrieve-only-text-not-nested-in-child-tags。 不过其实问题也不大,到时候再改也行。

fzlins avatar Oct 20 '24 23:10 fzlins

如果网站修改代码,find找不到元素,直接remove的话代码就会报错吧。

不会报错。 find方法返回的是jQuery对象

Whenever you use a "destructive" jQuery method that potentially changes the set of elements in the jQuery object, such as .filter() or .find(), that method actually returns a new jQuery object with the resulting elements.

A jQuery object may be empty, containing no DOM elements. You can create an empty jQuery object with $() (that is, passing no arguments at all). A jQuery object may also be empty if a selector doesn't select any elements, or if a chained method filters out all the elements. It is not an error; any further methods called on that jQuery object simply have no effect since they have no elements to act upon.

ixff avatar Oct 21 '24 03:10 ixff