-
-
Notifications
You must be signed in to change notification settings - Fork 78.7k
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
Modal: Apply any preexisting body padding again after closing #15930
Conversation
78ab28f
to
5c9af62
Compare
@@ -259,11 +260,12 @@ | |||
|
|||
Modal.prototype.setScrollbar = function () { | |||
var bodyPad = parseInt((this.$body.css('padding-right') || 0), 10) | |||
this.originalBodyPad = this.$body.attr('style') ? bodyPad : null |
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.
Won't this break with something like:
body { padding-right: 5px; }
<body style="color: red;">
?
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.
Yup, that's why I haven't merged it yet. Was thinking about checking it with /padding-right/i
, what do you think?
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.
What about !!this.$body[0].style.paddingRight
?
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.
Much better - I keep forgetting that Element.style
does not include computed styles.
5c9af62
to
039ba6d
Compare
@cvrebert LGTY now? Added another unit test for the case you described. |
What about |
039ba6d
to
6656f8e
Compare
Good catch. If only I was as wise as you are |
What would programming be without edge cases? :-P |
@@ -259,11 +260,12 @@ | |||
|
|||
Modal.prototype.setScrollbar = function () { | |||
var bodyPad = parseInt((this.$body.css('padding-right') || 0), 10) | |||
this.originalBodyPad = document.body.style.paddingRight || null |
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.
What about || ''
instead of || null
, and then getting rid of the ternary below?
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'm getting a little tired, that I could have noticed.
Nothing of interest, certainly 😄 |
6656f8e
to
3a01490
Compare
.bootstrapModal('show') | ||
}) | ||
|
||
QUnit.test('should ignore values set via CSS when trying to restore body padding after closing', function (assert) { |
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.
This test description needs to be updated
Once that description is fixed, 👍 💯 |
3a01490
to
142a9e4
Compare
Modal: Apply any preexisting body padding again after closing
Modifies #15273 to ignore padding set via CSS.