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
Test: ensure position/offset return mutable objects #3695
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, and I'm also in favor of reverting 3befe59 unless doing so increases gzipped size.
@@ -75,10 +75,11 @@ QUnit.test( "disconnected element", function( assert ) { | |||
assert.equal( result.top, 0, "Retrieving offset on disconnected elements returns zeros (gh-2310)" ); | |||
assert.equal( result.left, 0, "Retrieving offset on disconnected elements returns zeros (gh-2310)" ); | |||
assert.equal( Object.keys( result ).length, 2, "Retrieving offset on disconnected elements returns offset object (gh-3167)" ); | |||
assert.equal( jQuery.isPlainObject( result ), true, "Retrieving offset on disconnected elements returns plain object (gh-3612)" ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we be actually trying to mutate the object here? The jQuery.isPlainObject()
test is a bit of an indirect feature test and technically we could be returning a plain object with read-only properties.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess I was just ensuring it wasn't a ClientRect
. I could create a helper that checks both isPlainObject
and ensures it is modifiable. WDYT?
Agreed, revert 3befe59, and good to land. |
Was there any discussion about the use of |
I've added the revert of 3befe59 since it reduces size:
|
left: parentOffset.left + jQuery.css( offsetParent, "borderLeftWidth", true ) | ||
}; | ||
parentOffset.top += jQuery.css( offsetParent[ 0 ], "borderTopWidth", true ); | ||
parentOffset.left += jQuery.css( offsetParent[ 0 ], "borderLeftWidth", true ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think these need to be offsetParent
, not offsetParent[ 0 ]
.
* 'master' of git://github.com/jquery/jquery: (92 commits) Ajax: add an ontimeout handler to all requests Tests: Account for TestSwarm focus issues Tests: Simulate events when CI hinders use of native ones Tests: Reduce the abort timeout for simple focus testing Tests: Abort focus tests when the environment doesn't cooperate Tests: Try extra hard to control focus Support: Properly check for IE9 absolute scrollbox mishandling Dimensions: Detect and account for content-box dimension mishandling Offset: fix error from bad merge in jquery#3695 Revert "Offset: Resolve strict mode ClientRect "no setter" exception" Test: ensure position/offset return mutable objects Core: Deprecate jQuery.isWindow Event: `stopPropagation()` on native event-handler Build: fix uglify options for uglify update Build: Update sinon, husky, and qunitjs Build: update node dependencies; commit package-lock.json Deferred: fix memory leak of promise callbacks Dimensions: Include scroll gutter in "padding" box Tests: minor typos Build: Test on Node.js 8, stop testing on Node.js 7 ...
This adds tests verifying #3612. Could probably add more but this seemed to cover most cases?
Could potentially also revert 3befe59