-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Minor fixes to new media bindings #837
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.
Thanks, good catch on the logical expression. I don't understand why we need the if (!ranges)
guard?
src/shared/dom.js
Outdated
@@ -103,6 +103,7 @@ export function toNumber(value) { | |||
} | |||
|
|||
export function timeRangesToArray(ranges) { | |||
if (!ranges) return []; |
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.
when could this be the case?
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.
Because the src
attribute may not be present and then all the ranges attributes return undefined
.
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.
https://svelte.technology/repl?version=1.39.0&gist=66b93597de37579256dc333177c56e96
I could wrap the #each
in an #if
, but I don't really like to do that.
And since the method name is suffixed with ToArray
, I somehow expect it to always return an array, regardless of the input.
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.
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 what's happening here is we need to initialise the bindings to an empty array — adding the guard to this function probably won't fix it
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 need to initialise the bindings to an empty array
Ah ok, I can do that.
2782a6f
to
bfaab99
Compare
Done in bfaab99. Though I'm not entirely sure this is better. Judging from your screenshot, how can |
That's not quite what I meant — the binding needs to be initialised, i.e. the value of The workaround in the meantime is to initialise the value manually (note the I cherry-picked the first commit into #841, so I'll close this. Thanks. |
Thanks for merging #819, even though it wasn't perfect! Here are a two small fixes to things I've noticed when looking at d75ab85 or when playing around with the new release.