Open core-ai-bot opened 3 years ago
Comment by peterflynn Saturday Sep 07, 2013 at 01:06 GMT
I've boiled it down to just the following:
<!DOCTYPE html>
<html>
<body>
<div>
<h1>Look at this tiny little SVG chart</h1>
</div>
<div>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="50px" height="50px" viewBox="0 0 50 50" enable-background="new 0 0 50 50" xml:space="preserve">
<font horiz-adv-x="1000">
<font-face font-family="BebasNeue" units-per-em="1000" underline-position="-110" underline-thickness="50" />
</font>
</svg>
</div>
</body>
</html>
Perhaps w're attempting to treat the <font>
tag as the span-like regular HTML tag?
Comment by njx Saturday Sep 07, 2013 at 01:15 GMT
It's probably because of the hyphen in the font-face
tag name--we don't consider hyphens legal in tag names. My read of the HTML5 spec is that they're not legal (it says that tag names must consist of alphanumeric characters), but it could be that they're legal inside SVG blocks. In any case, it would be trivial to fix if we wanted to consider it legal.
Comment by TomMalbran Saturday Sep 07, 2013 at 01:30 GMT
The shadow DOM will uses hyphen tag names (e.g. x-tab
), although I think these need to always start with an x.
Comment by peterflynn Saturday Sep 07, 2013 at 01:33 GMT
Yeah, hyphens are definitely illegal in HTML 5.
It's unclear whether the spec allows hyphens in embedded SVG content, but my reading suggests it is still not allowed: "Foreign elements whose start tag is not marked as self-closing can have text, character references, CDATA sections, other elements, and comments, but the text must not contain the character "<" (U+003C) or an ambiguous ampersand." (where the word "elements" links back to the definition above, which says only alphanumeric chars.
The W3C validator seems to accept a hyphenated tag inside SVG, but it isn't clear whether it's even checking tag name validity -- outside SVG blocks, it gives the same generic "Content model for element div: Flow content" error for every unknown tag (whether <foo>
or <foo-bar>
). It doesn't seem to halt on the first error though, and it doesn't have any other complains about <foo-bar>
, so my guess is it's not validating the char composition of tag names at all.
Comment by peterflynn Saturday Sep 07, 2013 at 01:38 GMT
@
TomMalbran From what I can see in the Shadow DOM spec, it looks like x-
is only used in CSS selectors, never for actual existent DOM nodes... but I haven't read it in huge detail.
Comment by uptownnickbrown Saturday Sep 07, 2013 at 01:54 GMT
Looking at the SVG portion in the HTML5 spec, they don't reference font-face
(or other SVG elements with hyphens in the tag name) specifically. However, in the version of the SVG spec they do reference, this is what they have to say: "Each 'font' element must have a 'font-face' child element which describes various characteristics of the font."
So while it may be illegal in HTML5, it is mandatory for any <font>
styling functionality in inline SVG. Now maybe their intention is simply that font-face
info should solely be included via an external CSS @font-face
declaration?
Comment by peterflynn Friday Sep 13, 2013 at 08:53 GMT
@
TomMalbran Oops, looks like I was wrong about web components. I'm sitting in a CSSConf talk right now where I learned that there will indeed be hyphenated custom tag names -- it's just in the web components spec, not the shadow DOM spec.
Comment by couzteau Tuesday Sep 17, 2013 at 23:02 GMT
So what's wrong with the bad file? Live preview looks like this:
Comment by njx Wednesday Sep 18, 2013 at 17:18 GMT
I think the issue is that it doesn't update live as you type because it doesn't parse the SVG properly. (I haven't tried it myself though.)
Comment by uptownnickbrown Thursday Sep 19, 2013 at 18:37 GMT
@
njx - exactly right. Live Preview works, LiveHTML does not. So you don't get auto text updating, or element highlighting when you are working on an element in Brackets.
Working example:
Broken example:
Comment by njx Friday Oct 25, 2013 at 00:17 GMT
@
uptownnickbrown - we're now allowing hyphens in tag names; curious if it fixes your problem in this bug. Let us know what happens for you in sprint 33.
Comment by uptownnickbrown Sunday Nov 10, 2013 at 00:45 GMT
@
njx - it's still not quite working.
It seems like the initial parse is correct, so if you select an element in Brackets right after launching Live Preview, you'll see the correct element highlight in the browser.
But if you make any changes, they aren't reflected in the browser correctly - the behavior is similar to #5058.
Comment by njx Sunday Nov 10, 2013 at 02:09 GMT
There is another issue you might be running into if you have empty tags (<foo/>
) in your SVG: #5822. I have PR #5823 up to fix that.
(Note that even with this fix, editing the SVG itself won't update live--but editing the HTML around it should.)
Issue by uptownnickbrown Friday Sep 06, 2013 at 21:35 GMT Originally opened as https://github.com/adobe/brackets/issues/5101
I am unable to get the new LiveHTML feature to work for some pages with Inline SVG content, as I mentioned here on the Google Group.
However, in prepping a sample file that doesn't work I discovered that some pages with SVG content do work. I haven't yet been able to figure out a solid pattern. Here are two sample files: