Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
J
jquery
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
夏彬
jquery
Commits
ad040181
Commit
ad040181
authored
Aug 19, 2012
by
Mike Sherov
Committed by
Dave Methvin
Aug 20, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix #12283. Return null for dimension getters on non elements. Fix gh-900.
parent
9f86dc92
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
1 deletion
+17
-1
dimensions.js
src/dimensions.js
+1
-1
dimensions.js
test/unit/dimensions.js
+16
-0
No files found.
src/dimensions.js
View file @
ad040181
...
@@ -35,7 +35,7 @@ jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
...
@@ -35,7 +35,7 @@ jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
// Set width or height on the element
// Set width or height on the element
jQuery
.
style
(
elem
,
type
,
value
,
extra
);
jQuery
.
style
(
elem
,
type
,
value
,
extra
);
},
type
,
chainable
?
margin
:
undefined
,
chainable
);
},
type
,
chainable
?
margin
:
undefined
,
chainable
,
null
);
};
};
});
});
});
});
test/unit/dimensions.js
View file @
ad040181
...
@@ -385,6 +385,22 @@ test("passing undefined is a setter #5571", function() {
...
@@ -385,6 +385,22 @@ test("passing undefined is a setter #5571", function() {
equal
(
jQuery
(
"#nothiddendiv"
).
width
(
30
).
width
(
undefined
).
width
(),
30
,
".width(undefined) is chainable (#5571)"
);
equal
(
jQuery
(
"#nothiddendiv"
).
width
(
30
).
width
(
undefined
).
width
(),
30
,
".width(undefined) is chainable (#5571)"
);
});
});
test
(
"getters on non elements should return null"
,
function
()
{
expect
(
8
);
var
nonElem
=
jQuery
(
"notAnElement"
);
strictEqual
(
nonElem
.
width
(),
null
,
".width() is not null (#12283)"
);
strictEqual
(
nonElem
.
innerWidth
(),
null
,
".innerWidth() is not null (#12283)"
);
strictEqual
(
nonElem
.
outerWidth
(),
null
,
".outerWidth() is not null (#12283)"
);
strictEqual
(
nonElem
.
outerWidth
(
true
),
null
,
".outerWidth(true) is not null (#12283)"
);
strictEqual
(
nonElem
.
height
(),
null
,
".height() is not null (#12283)"
);
strictEqual
(
nonElem
.
innerHeight
(),
null
,
".innerHeight() is not null (#12283)"
);
strictEqual
(
nonElem
.
outerHeight
(),
null
,
".outerHeight() is not null (#12283)"
);
strictEqual
(
nonElem
.
outerHeight
(
true
),
null
,
".outerHeight(true) is not null (#12283)"
);
});
test
(
"setters with and without box-sizing:border-box"
,
function
(){
test
(
"setters with and without box-sizing:border-box"
,
function
(){
expect
(
20
);
expect
(
20
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment