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

CSSStyleDeclaration #42

Closed
1 task done
abrahamjuliot opened this issue Jul 25, 2020 · 7 comments
Closed
1 task done

CSSStyleDeclaration #42

abrahamjuliot opened this issue Jul 25, 2020 · 7 comments
Labels
enhancement New feature or request

Comments

@abrahamjuliot
Copy link
Owner

abrahamjuliot commented Jul 25, 2020

https://developer.mozilla.org/en-US/docs/Web/API/Window/getComputedStyle

  • test for breakage by injecting style to the body via inline styles, stylesheet, and style tag
    -- results not affected/no breakage:
    [1] removed the stylesheet
    [2] appended stylesheet (bootstrap cdn)
    [3] added style tag with color: blue !important
    [4] added inline style with color: blue !important
@abrahamjuliot abrahamjuliot added the bug Something isn't working label Jul 25, 2020
abrahamjuliot added a commit that referenced this issue Aug 2, 2020
abrahamjuliot added a commit that referenced this issue Aug 2, 2020
@abrahamjuliot abrahamjuliot changed the title computed style support in Firefox computed style support Aug 2, 2020
@abrahamjuliot abrahamjuliot added the enhancement New feature or request label Aug 2, 2020
@abrahamjuliot abrahamjuliot changed the title computed style support cross browser computed style support Aug 2, 2020
abrahamjuliot added a commit that referenced this issue Aug 2, 2020
abrahamjuliot added a commit that referenced this issue Aug 2, 2020
abrahamjuliot added a commit that referenced this issue Aug 2, 2020
abrahamjuliot added a commit that referenced this issue Aug 2, 2020
abrahamjuliot added a commit that referenced this issue Aug 2, 2020
abrahamjuliot added a commit that referenced this issue Aug 2, 2020
abrahamjuliot added a commit that referenced this issue Aug 2, 2020
abrahamjuliot added a commit that referenced this issue Aug 3, 2020
abrahamjuliot added a commit that referenced this issue Aug 3, 2020
abrahamjuliot added a commit that referenced this issue Aug 3, 2020
abrahamjuliot added a commit that referenced this issue Aug 3, 2020
abrahamjuliot added a commit that referenced this issue Aug 3, 2020
@abrahamjuliot abrahamjuliot reopened this Aug 3, 2020
@abrahamjuliot abrahamjuliot changed the title cross browser computed style support CSSStyleDeclaration Aug 3, 2020
@abrahamjuliot abrahamjuliot removed the bug Something isn't working label Aug 3, 2020
@abrahamjuliot abrahamjuliot pinned this issue Aug 3, 2020
@abrahamjuliot
Copy link
Owner Author

abrahamjuliot commented Aug 4, 2020

@abrahamjuliot
Copy link
Owner Author

abrahamjuliot commented Aug 4, 2020

Interesting find in Chrome:

  • HTMLElement.style and CSSRuleList.style only reveal alias attributes via the for...in loop. But, named attributes are valid on the CSSStyleDeclaration object:. For example, zIndex is returned via the for...in loop and not z-index, but 'z-index' in obj is true and obj['z-index'] returns a valid result "" instead of undefined. "The in operator returns true if the specified property is in the specified object or its prototype chain." - MDN

@abrahamjuliot
Copy link
Owner Author

//returns the prototype
Object.getOwnPropertyNames(Object.getPrototypeOf(document.body.style))

abrahamjuliot referenced this issue Aug 4, 2020
…rties and drop collection of keys and drop methods and properties from results
@abrahamjuliot
Copy link
Owner Author

abrahamjuliot commented Aug 4, 2020

d2c1ffc fixes Chrome and gives balanced/accurate readings across all 3 tests

  • dropped total keys since it is unnecessary and subject to easy manipulation
  • dropped methods and properties from the result to reduce output. Note, FF counts alias and named attributes as properties, so including it in the output is a useful option.

@abrahamjuliot
Copy link
Owner Author

abrahamjuliot commented Aug 5, 2020

dbea648:

  • preserve order -- entropy evidenced in chrome see 1107088
  • sort in a separate check to determine if keys are matching
  • identify prototype name -- FF and Chrome differ
  • drop CSSRuleList.style argument type check -- not required since I collect all properties and ignore duplicates
  • reduce styleVersion code
  • improve caniuse helper method to limit errors

@abrahamjuliot
Copy link
Owner Author

Safari Version 13.0.5 (15608.5.11): getComputedStyles returns an additional 9 keys
https://www.diffchecker.com/eJOL5Dhf

abrahamjuliot added a commit that referenced this issue Aug 29, 2020
@abrahamjuliot
Copy link
Owner Author

System Styles #70

abrahamjuliot added a commit that referenced this issue Sep 6, 2020
@abrahamjuliot abrahamjuliot unpinned this issue Sep 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant