Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Oct 20, 2024

Conversation

ixff
Copy link

@ixff ixff commented Oct 19, 2024

@fzlins
Copy link
Collaborator

fzlins commented Oct 20, 2024

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

@ixff
Copy link
Author

ixff commented Oct 20, 2024

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

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

@fzlins
Copy link
Collaborator

fzlins commented Oct 20, 2024

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

@fzlins fzlins merged commit a984c17 into pt-plugins:dev Oct 20, 2024
4 checks passed
@ixff
Copy link
Author

ixff commented Oct 21, 2024

如果网站修改代码,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 ixff deleted the remove-new-in-title branch October 21, 2024 03:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants