html - SVG filter in external file not being applied -


in file named gray.svg in assets directory have

<svg xmlns="http://www.w3.org/2000/svg" version="1.1" xmlns:xlink="http://www.w3.org/1999/xlink" width="0" height="0">     <filter id="grayscale">         <fecolormatrix type="matrix" values="0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0"/>     </filter> </svg> 

and in html have

<svg xmlns="http://www.w3.org/2000/svg" version="1.1" xmlns:xlink="http://www.w3.org/1999/xlink" width="100%" height="100%">     <image filter="url(assets/gray.svg#grayscale)"xlink:href="assets/images/linux.png" x="0" y="0" width="100%" height="100%"></image> </svg> 

i know assets/gray.svg#grayscale exists because when go inspector , click link takes me actual page svg defined in gray.svg.

moreover if don't have external .svg file, , put filter @ top of body , change filter in svg image #grayscale works.

i have no idea why it's not working. me out?

plunker

looks you've discovered this bug in chromium:

issue 109212: svg (filter | fill | stroke | clip-path | mask) external files not applied

what steps reproduce problem?

  1. define filter in svg file, assign id.
  2. embed svg in html file.
  3. use css directive "filter: url(file#id)" reference filter in svg file.

what expected result? filter should applied.

what happens instead? no filter applied.

your example works correctly in firefox.


Comments

Popular posts from this blog

facebook - android ACTION_SEND to share with specific application only -

python - Creating a new virtualenv gives a permissions error -

javascript - cocos2d-js draw circle not instantly -