Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Offset: simplify jQuery#offsetParent method#1968

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Closed
markelog wants to merge1 commit intojquery:masterfrommarkelog:offsetParent

Conversation

markelog
Copy link
Member

  • It seems, check for html element (and previously for body element)
    was redundant
  • Simplify "return" statement
  • Add comment about potential errors that didn't find themselves in real life app

This code would work even in IE6 quirks mode

// 3) For body or html element, i.e. in case of the html node - it will return itself
//
// but those exceptions were never presented as a real life use-cases
// and might be considered as more preferable results
Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

These exceptions would be better to put in the documentation too or instead of

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

If these are pathological cases that don't occur in real life, I am not sure why we are commenting them anyway. The result might change in a refactoring and these comments would no longer be true, but people might have read them as documented and supported.

Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

How about i will add a notice about it, like "But this is undefined and undocumented behavior, could be changed at any point" or something like that.

It feels weird to know about these edge cases, but not put some info about them somewhere.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

It really does seem like this is documentation. I am okay with putting a comment like "this is not guaranteed" nearby though and we can hope we don't need to change it.

* It seems, check for html element (and previously for body element)  was redundant* Simplify "return" statement* Add comment about potential errors that didn't find themselves in real life app
@dmethvin
Copy link
Member

Seems like this should addressgh-1765 as well since that will change the same code.

markelog added a commit that referenced this pull requestNov 10, 2015
* It seems, check for html element (and previously for body element)  was redundant* Simplify "return" statement* Add comment about potential errors that didn't find themselves  in real life appClosesgh-1968
@locklockbot locked asresolvedand limited conversation to collaboratorsJan 19, 2019
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.
Reviewers
No reviews
Assignees
No one assigned
Labels
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants
@markelog@dmethvin

[8]ページ先頭

©2009-2025 Movatter.jp