Closed cambiata closed 4 years ago
Thanks for the update! But I think it is better to preserve the white space (use space instead of tab) and not to alter if/else into ternary.
Thanks but there are still some tabs ^^"
Sorry, I edit directly in Github, and it keeps popping back to Tabs every time..! :-|
Yeah and they still exist, lol
Closing this - Found out that there's too much missing in tink_domspec https://github.com/haxetink/tink_domspec/blob/94fd4d03bf37f0ef822f1a44a18320c6529f8229/src/tink/domspec/Attributes.hx#L362.
@cambiata I have a similar problem, but your solution does not work for me. I tried with a different solution in setSvgProp
with
removeAttribute
and setAttribute
instead of removeAttributeNS
and setAttributeNS
.
Can you remember why you chose the ...AttributeNS
versions?
this works for me:
static inline function setSvgProp(element:Element, name:String, newVal:Dynamic, ?oldVal:Dynamic)
switch name {
case 'className':
if (newVal == null)
element.removeAttribute('class');
else
element.setAttribute('class', newVal);
case 'viewBox':
if (newVal == null)
element.removeAttributeNS(SVG, name);
else
element.setAttributeNS(SVG, name, newVal);
case 'xmlns':
case 'attributes':
Elt.setAttributes(element, newVal, oldVal);
case 'style':
@:privateAccess Elt.updateStyle(element.style, newVal, oldVal);
default:
if (newVal == null)
element.removeAttribute(name);
else
element.setAttribute(name, newVal);
}
Get basic svg attributes working (wievBox, width, height etc.). Correct that "class" attribute wrongly is named "className" in the generated output.