-
-
Notifications
You must be signed in to change notification settings - Fork 17
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
Moved classes member to base element #38
Moved classes member to base element #38
Conversation
@igagis I added a test for |
@JaimeIvanCervantes
It actually is
Could you provide more details on the use case you are trying to achieve? What do you mean by accessing some SVG element from Javascript? I know that elements of So, could you provide more details on your use case? Why do you need
You're very welcome to add the element support to |
@igagis I wanted to use a non-rendered element like My use case is basically accessing elements by
One should be able to access elements by As for svgdom not supporting the |
the existing For just searching purposes, a simpler visitors can be implemented (without caching style stacks): For searching by ID we need to add a new So, we can implement 3 new visitors for those cases, and since visitor in its Could you implement it that way? The searchers must go to |
by the way, what class names for those visitors is better in your opinion? |
Visitors would work, in fact I was planning of already implementing it this way, but I thought that having classes and tags as part of the base element made more sense. If the SVG spec says that Also, is
For the names of the finders/searchers, I would emulate Javascript:
In my case performance is very important too, so I was planning on using
I agree that this would make more sense, I found this confusing at the very beginning. Also, a minor optimization would be to change the |
See here: https://www.w3.org/TR/SVG11/types.html#InterfaceSVGStylable the description of
and the
According to https://www.w3.org/TR/SVG11/styling.html#InterfaceSVGStyleElement the
Ok, then I think the names should be
Probably yes, it can be changed to |
Ok you're right, it looks like |
This PR is moving the
classes
member to the baseelement
class, since classes are inherently part of the base element and should be part of every element type.The rationale for this change, is that CSS and
styleable
, is not the only reason that one would like to access the classes of any element. The element<desc>
is not styleable, yet could be accessed through Javascript for example (I know that svgdom does not support<desc>
, it's just an example, and I might add it later).NOTE: I need to do more test to make sure that I didn't break anything, but wanted to open the PR as soon as possible to hear your opinion @igagis. I also want to open a similar PR to move the
tag
to the base element as well.