Skip to content

[css-typed-om] StylePropertMap.set for non-list properties #512

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

Closed
darrnshn opened this issue Nov 9, 2017 · 1 comment
Closed

[css-typed-om] StylePropertMap.set for non-list properties #512

darrnshn opened this issue Nov 9, 2017 · 1 comment

Comments

@darrnshn
Copy link
Collaborator

darrnshn commented Nov 9, 2017

What should StylePropertyMap.set do for non-list properties when given multiple arguments? e.g.

styleMap.set('width', CSS.px(1), CSS.px(2), CSS.px(3));
styleMap.getAll('width'); // ???

According to the spec, the "property model" will contain an entry ("width", [1px, 2px, 3px]). It's then unclear what getAll should return. If we follow the spec strictly, we return [[1px, 2px, 3px]] (a single-element list containing a 3-element list), which is probably not right... Should set throw an exception or just set the first element?

MXEBot pushed a commit to mirror/chromium that referenced this issue Nov 23, 2017
Currently StylePropertyMaps don't support strings e.g.

  styleMap.set('width', CSS.px(1)) works, but
  styleMap.set('width', '1px') doesn't.

This patch adds string support by moving parsing code to
StyleValueFactory so that both CSSStyleValue.parse and
StylePropertyMaps can share the parsing logic.

We also do some refactoring to make handling both CSSStyleValue
and strings easier.

There are still some code paths that we're not sure is correct,
pending clarification on GitHub:
w3c/css-houdini-drafts#512

Spec: https://drafts.css-houdini.org/css-typed-om-1/#the-stylepropertymap

Bug: 545318
Change-Id: Iaef3cfad69789fc115b7e98a296eec5cb4480cd8
Reviewed-on: https://chromium-review.googlesource.com/769797
Commit-Queue: Darren Shen <shend@chromium.org>
Reviewed-by: nainar <nainar@chromium.org>
Cr-Commit-Position: refs/heads/master@{#518443}
@tabatkins
Copy link
Member

Actually, it just silently treats all properties as list-valued, even when they're not. This is still a bug tho - it's inconsistent with how .append() works on single-valued properties (it throws). We should be consistent here and just throw in both situations, so calling .set() on a single-valued property with more than one value should throw a TypeError.

MXEBot pushed a commit to mirror/chromium that referenced this issue Dec 15, 2017
When setting multiple values on a non list valued property, we resolved
to throw a TypeError.

Spec:
w3c/css-houdini-drafts#512

Bug: 785132
Change-Id: I2a1a06ffc3eb6db66e08e2537eeaa570feaff0d3
Reviewed-on: https://chromium-review.googlesource.com/826744
Reviewed-by: nainar <nainar@chromium.org>
Commit-Queue: Darren Shen <shend@chromium.org>
Cr-Commit-Position: refs/heads/master@{#524182}
@nainar nainar added the claimed label Jan 29, 2018
nainar added a commit that referenced this issue Jan 29, 2018
tabatkins pushed a commit that referenced this issue Jan 29, 2018
… list prop (#599)

* StylePropertyMap.set should throw when setting multiple values to non list property

Fixes #512

* Swap to a positive term.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants