Comments (5)
Good point - and no rush, btw, a simple workaround for now is to just have the SVG symbols in an asset and link them into the document using
<svg><use xlink:href="icons.svg#cool-svg-symbol"></use></svg>
then all the camel case sensitive stuff is in the symbols in the asset and it still acts as if it was inlined.
from file-system.
This is actually not a Webstrates or file system bug. If you try adding an attribute to any non-webstrates page using the Inspector, it will also be lowercased automatically. A workaround is to use Element.setAttribute
manually.
E.g. inserting
<svg viewBox="0,0,100,100"></svg>
will change the attribute to viewbox
rather than viewBox
. However, if you first insert
<svg></svg>
and then do
$0.setAttribute("viewBox", "0,0,100,100");
the attribute will remain as viewBox
, but only if the element is an <svg>
.
It might be possible to create a workaround for this in the Webstrates code as well. I'll look into that.
from file-system.
That is interesting - the inspector doesn't lowercase svg attributes in Chromium here but most (all?) other elements have their attributes lowercased as soon as you click away from them. I guess they have hardcoded svg elements and their children as a special case.
Webstrates seemingly supports persisting the inspector-edited camelCase attribute in Chromium and can reload it in the same or other browsers as long as the filesystem script isn't running. If the script is running the attribute will be lowercased upon updating the file (even if the newly written file has the attribute camelcased when written from an external editor).
from file-system.
Indeed. Or the "hardcoding" is probably more related to the specific namespace that SVG elements use. You will notice that Element.namespaceURI
is set to "http://www.w3.org/1999/xhtml" for virtually all elements, except <svg>
s which use "http://www.w3.org/2000/svg".
Yes, the file system might screw around with casing then. We've ignoring casing on tag names (and possibly attributes, I don't recall), because the different browsers can't seem to agree on when the Element.tagName
property should be capitalized. Again, it's something I'll look into. :-)
from file-system.
This has been fixed since switching jsonml-parse
for my own parse5
-based package html-to-jsonml
a while back (9021b94).
parse5
adheres to the HTML5 specification, meaning HTML attributes are case-insensitive, but XML attributes are case-sensitive. As such, <div viewBox></div>
(for instance) will indeed turn into <div viewbox></div>
, but <svg viewBox></svg>
will remain unchanged.
from file-system.
Related Issues (11)
- No error when connection not established HOT 1
- <transient> tag causes issues
- Occasional crashes when files update a lot HOT 1
- Oneshot read/write HOT 3
- HTML comments can cause the output to be garbled HOT 2
- File change detection corrupts file HOT 2
- HTML entities are acting up HOT 1
- --oneshot doesn't properly cover assets HOT 1
- Name Collision with Windows Fax and Scan when installed globally with npm on Win10 HOT 1
- Installation fail with node v11.11.0, npm 6.9.0, macOS 10.14.3 HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from file-system.