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

Implement SVGElement.style #26777

Closed
CYBAI opened this issue Jun 4, 2020 · 4 comments · Fixed by #26789
Closed

Implement SVGElement.style #26777

CYBAI opened this issue Jun 4, 2020 · 4 comments · Fixed by #26789
Labels
A-content/dom Interacting with the DOM from web content A-content/svg

Comments

@CYBAI
Copy link
Member

CYBAI commented Jun 4, 2020

Spec: https://drafts.csswg.org/cssom/#dom-elementcssinlinestyle-style

With implementing this, we should be able to fix #26032.

@CYBAI CYBAI added A-content/dom Interacting with the DOM from web content A-content/svg labels Jun 4, 2020
@CYBAI
Copy link
Member Author

CYBAI commented Jun 4, 2020

Tried to implement style for SVGElement, I found it doesn't fix #26032 and we still can't get style for the create svg circle element :/

const x = document.createElementNS("http://www.w3.org/2000/svg", "circle");
console.log(x.style);

In Gecko, this will log an empty CSS2Properties but it will log undefined in Servo even SVGElement includes ElementCSSInlineStyle.

@jdm
Copy link
Member

jdm commented Jun 4, 2020

I have a suspicion that the element returned from createElementNS is a generic Element, rather than an SVGElement. It's worth checking if that is the case.

@CYBAI
Copy link
Member Author

CYBAI commented Jun 4, 2020

Cool! Yes! It currently returns a generic Element.

match name.local {
local_name!("svg") => make!(SVGSVGElement),
_ => Element::new(name.local, name.ns, prefix, document),
}

Before implementing other svg elements, should we return a generic SVGElement here instead?

@jdm
Copy link
Member

jdm commented Jun 4, 2020

Yes, that should help.

bors-servo added a commit that referenced this issue Jun 4, 2020
Introduce ElementCSSInlineStyle for SVGElement

---
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #26777 and fix #26032 and fix #21990
- [x] There are tests for these changes

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-content/dom Interacting with the DOM from web content A-content/svg
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants