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 #17964 #17997

Merged
merged 3 commits into from
Oct 30, 2016
Merged

Fix #17964 #17997

merged 3 commits into from
Oct 30, 2016

Conversation

deilv
Copy link
Contributor

@deilv deilv commented Oct 20, 2015

Some browsers are lazy when updating dom elements after transition effects. This can be fixed by reading element properties such as offsetHeight or offsetWidth, which causes the browser to resync (reflow) the element.

However, creating a function using the Function constructor just to access such element properties, results in a violation of Content Security Policy (where applied), which in turn crashes the application. This fix actually reverts to the way this was handled in v3 and should work as intended.

Some browsers are lazy when updating dom elements after transition effects. This can be fixed by reading element properties such as offsetHeight or offsetWidth. However, creating a function using the Function constructor just to access such element, results in a violation of Content Security Policy (where applied), which in turn crashes the application. This fix actually reverts to the way this was handled in v3 and should work as intended.
@@ -116,7 +116,7 @@ const Util = (($) => {
},

reflow(element) {
new Function('bs', 'return bs')(element.offsetHeight)
return element.offsetHeight

Choose a reason for hiding this comment

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

Missing semicolon.

Copy link
Contributor

Choose a reason for hiding this comment

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

Semicolon is forbidden.

Copy link
Contributor

Choose a reason for hiding this comment

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

It is necessary to adjust the hound...

Copy link
Contributor

Choose a reason for hiding this comment

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

javascript write without _ (undescore) https://houndci.com/configuration#javascript.

I think java_script is ignore in .hound.yml

Copy link
Collaborator

Choose a reason for hiding this comment

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

Thanks, fixed in 18ad53f

cvrebert added a commit that referenced this pull request Oct 20, 2015
Per #17997 (comment) ; thanks @vsn4ik !
Refs #17769
/fyi @croaky

[ci skip]
cvrebert added a commit that referenced this pull request Oct 20, 2015
Per #17997 (comment) ; thanks @vsn4ik !
Refs #17769
/fyi @croaky

[ci skip]
@cvrebert cvrebert added this to the v4.0.0-alpha.2 milestone Oct 20, 2015
@mdo mdo modified the milestones: v4.0.0-alpha.2, v4.0.0-alpha.3 Dec 8, 2015
@mdo mdo modified the milestones: v4.0.0-alpha.3, v4.0.0-alpha.4 May 8, 2016
@mdo
Copy link
Member

mdo commented Oct 10, 2016

Curious if I could get some eyes on this from other folks who've pushed JS changes—@cvrebert, @Johann-S, or @bardiharborow. Know it's a small change, but I don't know the full context here <3.

@bardiharborow
Copy link
Member

I actually did see this in the code and was wondering what we should do about it. The concern I have is that it was probably written in such a novel way because of a browser bug and I would want to ensure that it isn't still necessarily. So far I've traced it back to 834220e, but there is little indication why it was added.

@mdo mdo modified the milestones: v4.0.0-alpha.6, v4.0.0-alpha.5 Oct 10, 2016
@mdo
Copy link
Member

mdo commented Oct 10, 2016

I'll punt it to Alpha 6 until we know more then. We can always ping @fat to see if it needs to stay the same, but if this is coming from that Closure commit, I'm willing to bet it's not a weird browser thing. Thanks for looking!

@bardiharborow
Copy link
Member

bardiharborow commented Oct 10, 2016

I've found some references to this technique on StackExchange, though they don't use Function. I'm guessing that was to stop some minifier from stripping the dead code. Per my conversation on #chromium with ellyjones, I'm going to file a Chrome bug to actually get this fixed.

@mdo
Copy link
Member

mdo commented Oct 29, 2016

Okay, so maybe we punt on this for now then @bardiharborow?

@bardiharborow
Copy link
Member

@mdo, I'd say merge this. The Function wrapper seems pointless based on everything I've read, it's more to stop Closure from being too smart and removing this entirely. The element.offsetHeight itself needs to be looked into by the Chrome team and should be removed eventually when the underlying bug is fixed.

@mdo mdo merged commit bf43936 into twbs:v4-dev Oct 30, 2016
@mdo mdo mentioned this pull request Oct 30, 2016
@deilv deilv deleted the v4-dev-fix-17964 branch October 31, 2016 17:57
chiraggmodi pushed a commit to chiraggmodi/bootstrap that referenced this pull request Apr 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants