0

Situation:

My customer wants me to put a SVG drawing within his page; so my part is reduced to

<svg ..> 
    ..
</svg>

and

<script>..</script>

I want (need) to add some private (ie. no std. attr) information to the drawing (i call it charly now): this one (this two variants) worke fine with firefox:

<svg id='myHorribleDrawing' xmlns='http://www.w3.org/2000/svg' ....>
...
<g id='000000000230865' charly ='xxx' ... >
    <charlydata charly ='xxx '/>
    <use x='304.0' y='74.5'  width='30' height='30'  xlink:href='#path'  />
</g>
...
</svg>

both work fine - just foist the attrib or a unknow element. Firefox (for example) eats that, as if nothing was wrong.

But i am sure that this is - just - wrong.

My resaerch brought me to modifiying DTD (hu, hard stuff) but I am not the owner of the DOCTYPE! so an other try

Try number two was to declare an private namspace (mycharly)

<svg xmlns='http://www.w3.org/2000/svg'  version='1.2'....
  xmlns:mycharly='http://www.example.org/charles'>
...
<g ...>
<mycharly:charlydata charly='blind'>  
(and close it all)

Workes fine, browser takes it without any protest. the only difference is, that jQuery does not like the 'mycharly:charlydata' selector ...

I was serching for hours, what the correct way to do this would be, and I am ending up with the idea, that there is no way, or do I only 'not see the wood because of all the trees'? (an austrian saying)

halfbit
  • 3,773
  • 2
  • 34
  • 47
  • hhx, twice \\ i tried only one"\", so i can resolve my "chraly:charlydata", but whow about the whole context? – halfbit Sep 08 '13 at 22:54
  • I don't understand your comment. Please clarify in the question exactly what you want and why it is not a duplicate (assuming you think it isn't). – Robert Longson Sep 09 '13 at 07:23
  • first, it should be "thx" (i still fight with this small laptop keyboard).. With the '"\\" trick I can solve my jQuery namespace issue (I tried to use one only '\' this did not work). But: The main question was: is it correct to expand HTML/SVG this way? – halfbit Sep 09 '13 at 09:43
  • 1
    Yes, it's valid to do that if that's what you wanted to know. – Robert Longson Sep 09 '13 at 10:04

1 Answers1

0

Please consider doing something like:

    <com.example:data keys="important">Special information for own use</com.example:data>