Comments (5)
Is the regexp usage unnecessary here. We want to exact match on this line and can be as var svg = svg || SvgOnlyTags.indexOf(tag)!= -1
from surplus.
It's a single char typo. In SvgOnlyTagRx, the $ anchoring the end of the match is inside the parens when it should be outside. So it only anchors the last tag, not all of them. I'm away camping with the family but will fix it as soon as I'm back.
from surplus.
No hurry! sometimes need to raise head from the computer. I can go on with these kind of things I've done in my own repository. The following code can provide convenience for simulating the problem.
var SvgOnlyTags = [
"text",
"textPath"
],
SvgOnlyTagRx = new RegExp("^(" + SvgOnlyTags.join("|") + "$)")
console.log(SvgOnlyTagRx.test("textField")) // true!!!!!!
from surplus.
Pushed fix.
The reason for the RX over an array search is both performance and expressive power. I don't care nearly as much about performance in the preprocessor as I do in the runtime and generated code, but using an RX here is O(tag length) vs an array search which is O(tag length * # of SVG tags). V8's regex implementation is pretty darn fast.
from surplus.
Good
from surplus.
Related Issues (20)
- Cannot set style attribute by string HOT 2
- input's "list" attribute HOT 1
- template tag function? HOT 13
- SArray.slice() versus slicing the update value HOT 1
- Fragments? HOT 7
- add and enable Travis CI
- Getting a circular dependency warning with Rollup HOT 5
- Emoijs aren't encoded correctly HOT 4
- Question: Surplus + TypeScript - debugging experience (issue with source maps?) HOT 5
- Not compatible with S.subclock HOT 2
- Basics of Surplus Array rendering HOT 5
- `transform` CSS property not working HOT 1
- Proposal for attribute+signal shorthand HOT 14
- Attribute spread and fn don't work HOT 3
- Compiler chokes on regular expression literal HOT 3
- svg xlink support? HOT 2
- Missing support for dynamic/string-based tags HOT 3
- Support for arrays in className HOT 4
- reconcileArrays fails on parent.insertBefore
- Rewriting default examples to avoid the error "computations created without a root or parent will never be disposed"
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 surplus.