-
Notifications
You must be signed in to change notification settings - Fork 7.5k
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
Default dimensions #2482
Default dimensions #2482
Conversation
Tests failed. Automated cross-browser testing via Sauce Labs and Travis CI shows that the JavaScript changes in this pull request are: BUSTED Commit: c705b59 (Please note that this is a fully automated comment.) |
heff [13:34] gkatsev [14:11] heff [14:21] gkatsev [14:22]
gkatsev [14:23] gkatsev [14:23]
gkatsev [14:23] heff [14:24] gkatsev [14:37] gkatsev [14:43] pat [14:45] pat [14:46] mmcc [15:14] gkatsev [15:14] mmcc [15:15] mmcc [15:15] mmcc [15:15] mmcc [15:18] gkatsev [15:18] mmcc [15:18] gkatsev [15:18] gkatsev [15:19] gkatsev [15:19]
mmcc [15:21] gkatsev [15:22]
mmcc [15:24] gkatsev [15:24] mmcc [15:24] gkatsev [15:25] mmcc [15:25] pat [15:26] ['.video-js',
['width', '300px'],
['height', '150px']
] .video-js {
width: 300px;
height: 150px;
} 135b JavaScript/JSON • Edit • New window • View raw • Add comment mmcc [15:26] mmcc [15:27] gkatsev [15:27] mmcc [15:28] mmcc [15:28] mmcc [15:28] mmcc [15:29] pat [15:29] |
So, proposal: stylesheet.addCssRules(this.styleEl_.sheet, [
['.' + idClass,
['width', width + 'px'],
['height', height + 'px']
],
['.' + idClass + '.vjs-fluid',
['padding-top', (ratioMultiplier*100) + '%']
]
]); You would do: stylesheet.addCssRule(this.styleEl.sheet, '.' + idClass, `width: ${width}px; height: ${height}px;`);
stylesheet.addCssRule(this.styleEl.sheet, `.${idClass}.vjs-fluid`, `padding-top: ${ratioMultiplier * 100}%`); It would still use |
Can you test that this direction works in IE8? If this lightens the added code I'll concede the direction. Still feels like we're using a spoon instead of a shovel to dig the same hole. It'd be nice if we could point to some other difference besides one DOM API is more right than the other, because that still feels debatable. |
I'll take a look at the I'll think about it some more but generally I much prefer using an actual API, if available, over just setting the inner text of an element. |
8d7d486
to
26e55c3
Compare
Tests failed. Automated cross-browser testing via Sauce Labs and Travis CI shows that the JavaScript changes in this pull request are: BUSTED Commit: 8d7d48612bda09bef32f86724aa3717ff06afc34 (Please note that this is a fully automated comment.) |
Tests failed. Automated cross-browser testing via Sauce Labs and Travis CI shows that the JavaScript changes in this pull request are: BUSTED Commit: 26e55c3 (Please note that this is a fully automated comment.) |
@@ -172,7 +172,6 @@ test('should set the width, height, and aspect ratio via a css class', function( | |||
}; | |||
|
|||
// Initial state | |||
ok(player.styleEl_.parentNode === player.el(), 'player has a style element'); |
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.
we're no longer adding this element to the player. The tests below should cover whether the styles are applied correctly or not.
This one is good to go, I think. |
Tests failed. Automated cross-browser testing via Sauce Labs and Travis CI shows that the JavaScript changes in this pull request are: BUSTED Commit: 01191ed (Please note that this is a fully automated comment.) |
The test failure is a timeout. |
this.styleEl_ = stylesheet.getStyleElement('vjs-styles-dimensions'); | ||
let defaultsStyleEl = document.querySelector('.vjs-styles-defaults'); | ||
let head = document.querySelector('head'); | ||
head.insertBefore(this.styleEl_, defaultsStyleEl ? defaultsStyleEl.nextSibling : head.firstChild); |
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 worry about scenarios where defaultsStyleEl
is the only thing in the head. Or if there is no head for some reason?
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 don't think it's worth worrying about if there's no head. I think looking for the defaultsStyleEl
and prepending to HEAD otherwise, is quick and easy enough to do.
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.
Sounds good.
lgtm! |
Tests failed. Automated cross-browser testing via Sauce Labs and Travis CI shows that the JavaScript changes in this pull request are: BUSTED Commit: c020041 (Please note that this is a fully automated comment.) |
@pam retry |
Tests failed. Automated cross-browser testing via Sauce Labs and Travis CI shows that the JavaScript changes in this pull request are: BUSTED Commit: 58088ba (Please note that this is a fully automated comment.) |
…of HEAD el. closes videojs#2482
Remove default dimensions from the stylesheet. Add them back in when videojs loads.
Add move the dimensions stylsheet into the head of the document.