admin管理员组文章数量:1391964
Our website suddenly stopped working on Chrome (just chrome) after the latest update...
The error given is
Uncaught TypeError: Cannot read property 'numberOfItems' of undefined
This is where the numberOfItems property is used:
// Absolutize and parse path to array
, parse: function(array) {
/* if it's already is a patharray, no need to parse it */
if (array instanceof SVG.PathArray) return array.valueOf()
/* prepare for parsing */
var i, il, x0, y0, x1, y1, x2, y2, s, seg, segs
, x = 0
, y = 0
/* populate working path */
SVG.parser.path.setAttribute('d', typeof array === 'string' ? array : arrayToString(array))
/* get segments */
segs = SVG.parser.path.pathSegList
for (i = 0, il = segs.numberOfItems; i < il; ++i) {
seg = segs.getItem(i)
s = seg.pathSegTypeAsLetter
etc. (I didn't put the whole loop)
Why did SVG and Javascript stop being able to read this property after the latest Chrome update? What could be a good fix?
Thanks!!
Our website suddenly stopped working on Chrome (just chrome) after the latest update...
The error given is
Uncaught TypeError: Cannot read property 'numberOfItems' of undefined
This is where the numberOfItems property is used:
// Absolutize and parse path to array
, parse: function(array) {
/* if it's already is a patharray, no need to parse it */
if (array instanceof SVG.PathArray) return array.valueOf()
/* prepare for parsing */
var i, il, x0, y0, x1, y1, x2, y2, s, seg, segs
, x = 0
, y = 0
/* populate working path */
SVG.parser.path.setAttribute('d', typeof array === 'string' ? array : arrayToString(array))
/* get segments */
segs = SVG.parser.path.pathSegList
for (i = 0, il = segs.numberOfItems; i < il; ++i) {
seg = segs.getItem(i)
s = seg.pathSegTypeAsLetter
etc. (I didn't put the whole loop)
Why did SVG and Javascript stop being able to read this property after the latest Chrome update? What could be a good fix?
Thanks!!
Share Improve this question edited Feb 2, 2016 at 15:57 Robert Longson 125k27 gold badges267 silver badges253 bronze badges asked Jan 31, 2016 at 22:58 Juanbi BerrettaJuanbi Berretta 1155 bronze badges 5-
Check the value of
segs
in debugger. – pratikpawar Commented Jan 31, 2016 at 23:24 - Their is a working draft that's being implemented at the moment around SVG 'path' elements. It's possible their is a bug (svgwg/svg2-draft/paths.html#InterfaceSVGPathElement). I'd try Canary and see if the issue is present in it or not. – Todd Moore Commented Jan 31, 2016 at 23:28
-
Unrelated: don't omit
;
s. This will bite you. Hard. – jcaron Commented Feb 1, 2016 at 0:15 - See stackoverflow./questions/34919405/svgpathdata-chrome-48 – Robert Longson Commented Feb 1, 2016 at 2:44
- This issue was solved in svg.js as soon as it was known (released 30.11.2015). So you just have to update your version – Fuzzyma Commented Feb 14, 2016 at 21:27
1 Answer
Reset to default 9Chrome removed the pathSeg interface in version 48.
There's more information in their public issue tracker
There's also an issue tracking the implementation of the replacement API in the meantime there are polyfills available to reinstate support for the old API
本文标签: javascriptSVG numberOfItems property not workingStack Overflow
版权声明:本文标题:javascript - SVG numberOfItems property not working - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744757939a2623573.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论