New issue
Advanced search Search tips

Issue 606200 link

Starred by 4 users

Issue metadata

Status: Fixed
Owner:
Closed: Apr 2016
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 2
Type: Compat



Sign in to add a comment

SVGAnimatedString.animVal should contain the same value as baseVal but is empty

Reported by rick...@gmail.com, Apr 24 2016

Issue description

UserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.86 Safari/537.36

Example URL:
https://jsfiddle.net/z1wax9aa/

Steps to reproduce the problem:
1. Go to the URL https://jsfiddle.net/z1wax9aa/
2. Observe the rendered HTML output

What is the expected behavior?
The URL https://jsfiddle.net/z1wax9aa/ displays "animVal" and "baseVal" properties of two <a> elements inside a <svg> element. The first <a> element specify a hyperlink use "xlink:href" according to https://www.w3.org/wiki/SVG_Links ; the second <a> just uses "href" to specify a hyperlink.

According to https://developer.mozilla.org/en/docs/Web/API/SVGAnimatedString :

"If the given attribute or property is not currently being animated", (animVal) contains the same value as baseVal".

Therefore for the <a xlink:href="url> element, its href.animVal should be as same as href.baseVal, or "http://example.com".

What went wrong?
The animVal property of xlink:href is empty ("").

Does it occur on multiple sites: Yes

Is it a problem with a plugin? No 

Did this work before? Yes Chrome 49 stable

Does this work in other browsers? Yes 

Chrome version: 50.0.2661.86  Channel: stable
OS Version: OS X 10.11.4
Flash Version: Shockwave Flash 21.0 r0

This works in
* Chrome 49.0.2623.87 win64 and OSX
* Safari 9.1 (11601.5.17.1) OSX
* IE 11 x64 Windows 10
* Edge Windows 10

In Chrome 49 and Safari 9.1 animVal and baseVal are correct for xlink:href. For href inside SVG, animVal and baseVal are empty.

In IE 11 and Edge, animVal and baseVal of both xlink:href and href are all "http://example.com".

The wrong empty animVal may break SVG URL resolving for Angular JS, which in some cases use animVal (https://github.com/angular/angular.js/blob/v1.5.x/src/ng/location.js#L875)
 
Cc: f...@opera.com
Components: -Blink Blink>SVG
fs@ you have been quoted in #1 as possibly having an issue with your commit.

Comment 3 by f...@opera.com, Apr 25 2016

Cc: -f...@opera.com
Labels: -Type-Bug -OS-Mac OS-All Type-Compat
Owner: f...@opera.com
Status: Assigned (was: Unconfirmed)
AFAICT, our behavior matches that described by the spec:

"The SVGAnimatedString interface is defined to reflect through its baseVal member the deprecated ‘xlink:href’ attribute, if that attribute is present and the ‘href’ is not, and to reflect the ‘href’ attribute in all other circumstances. The animVal attribute reflects the animated value of the ‘href’ attribute. Animation elements treat attributeName='xlink:href' as being an alias for targetting the ‘href’ attribute."

(https://svgwg.org/svg2-draft/types.html#InterfaceSVGURIReference)

The reason this "works" in Edge is because there baseVal === animVal. If we manage to remove SMIL support, then we should be able to do that too.

It's a simple fix to make animVal reflect the attribute that's "in use" though, so I guess we might as well do that. I'll raise an issue on the SVG spec to make the WG aware of this issue.

Comment 4 by f...@opera.com, Apr 25 2016

And I see now that was just a note...

Comment 5 by f...@opera.com, Apr 25 2016

Anyway, raised https://github.com/w3c/svgwg/issues/127 to get the note clarified.
Project Member

Comment 6 by bugdroid1@chromium.org, Apr 25 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/1d488d94b705ce49d710ba9f992f8c31a24c79e0

commit 1d488d94b705ce49d710ba9f992f8c31a24c79e0
Author: fs <fs@opera.com>
Date: Mon Apr 25 16:15:03 2016

Return the 'active' value for SVGURIReference.href.animVal

Make animVal return the currently used ('active') value instead of always
returning that of 'href'.
This should re-establish the former "invariant" that baseVal === animVal
when '(xlink:)href' is not being animated.

BUG= 606200 

Review URL: https://codereview.chromium.org/1917843002

Cr-Commit-Position: refs/heads/master@{#389490}

[modify] https://crrev.com/1d488d94b705ce49d710ba9f992f8c31a24c79e0/third_party/WebKit/LayoutTests/svg/dom/href-semantics.html
[modify] https://crrev.com/1d488d94b705ce49d710ba9f992f8c31a24c79e0/third_party/WebKit/Source/core/svg/SVGAnimatedHref.cpp

Project Member

Comment 7 by bugdroid1@chromium.org, Apr 25 2016

Labels: merge-merged-2716
The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/1d488d94b705ce49d710ba9f992f8c31a24c79e0

commit 1d488d94b705ce49d710ba9f992f8c31a24c79e0
Author: fs <fs@opera.com>
Date: Mon Apr 25 16:15:03 2016

Return the 'active' value for SVGURIReference.href.animVal

Make animVal return the currently used ('active') value instead of always
returning that of 'href'.
This should re-establish the former "invariant" that baseVal === animVal
when '(xlink:)href' is not being animated.

BUG= 606200 

Review URL: https://codereview.chromium.org/1917843002

Cr-Commit-Position: refs/heads/master@{#389490}

[modify] https://crrev.com/1d488d94b705ce49d710ba9f992f8c31a24c79e0/third_party/WebKit/LayoutTests/svg/dom/href-semantics.html
[modify] https://crrev.com/1d488d94b705ce49d710ba9f992f8c31a24c79e0/third_party/WebKit/Source/core/svg/SVGAnimatedHref.cpp

Comment 8 by f...@opera.com, Apr 27 2016

Labels: Merge-Request-51

Comment 9 by tin...@google.com, Apr 27 2016

Labels: -Merge-Request-51 Merge-Approved-51 Hotlist-Merge-Approved
Your change meets the bar and is auto-approved for M51 (branch: 2704)
Project Member

Comment 10 by bugdroid1@chromium.org, Apr 27 2016

Labels: -merge-approved-51 merge-merged-2704
The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/187e748f9e1f2c4bb98fafcee381af8e9b052d1d

commit 187e748f9e1f2c4bb98fafcee381af8e9b052d1d
Author: Fredrik Söderquist <fs@opera.com>
Date: Wed Apr 27 11:15:54 2016

Return the 'active' value for SVGURIReference.href.animVal

Make animVal return the currently used ('active') value instead of always
returning that of 'href'.
This should re-establish the former "invariant" that baseVal === animVal
when '(xlink:)href' is not being animated.

BUG= 606200 

Review URL: https://codereview.chromium.org/1917843002

Cr-Commit-Position: refs/heads/master@{#389490}
(cherry picked from commit 1d488d94b705ce49d710ba9f992f8c31a24c79e0)

Review URL: https://codereview.chromium.org/1926643002 .

Cr-Commit-Position: refs/branch-heads/2704@{#263}
Cr-Branched-From: 6e53600def8f60d8c632fadc70d7c1939ccea347-refs/heads/master@{#386251}

[modify] https://crrev.com/187e748f9e1f2c4bb98fafcee381af8e9b052d1d/third_party/WebKit/LayoutTests/svg/dom/href-semantics.html
[modify] https://crrev.com/187e748f9e1f2c4bb98fafcee381af8e9b052d1d/third_party/WebKit/Source/core/svg/SVGAnimatedHref.cpp

Comment 11 by f...@opera.com, Apr 27 2016

Status: Fixed (was: Assigned)

Comment 12 by ajha@chromium.org, May 4 2016

Labels: TE-Verified-51.0.2704.36 TE-Verified-M51
Verified the merge on the latest M-51(51.0.2704.36) on Windows-7, Mac OS 10.11.4 and Linux Ubuntu 14.04. This is working as intended. Attached is the screenshot of the same.


606200.png
181 KB View Download

Comment 13 by f...@opera.com, Jun 2 2016

Cc: f...@opera.com
 Issue 616454  has been merged into this issue.

Sign in to add a comment