RE: [svg-developers] finding the HTML whose SVG was clicked upon

Sat, 23 Jul 2011 13:12:42 -0700

Thanks Erik,

 

I don’t think I’d have figured out .ownerDocument.defaultView.frameElement  
using  the British Museum Algorithm despite my fondness for it!

 

You can see why I was interested at  
http://srufaculty.sru.edu/david.dailey/svg/text/texteffects2.htm (Opera will be 
needed for these,  though, because of advanced filter effects and animation!)

 

I would have done it with straight SVG, as in the static versions at  
http://srufaculty.sru.edu/david.dailey/svg/text/texteffects2.htm but didn’t see 
any way to embed SVG in SVG other than through <image> and then the animations 
don’t work (except for maybe some SMIL in a random browser here or there). SVG 
does make for better thumbnails than HTML where one needs to go over to the 
serverside and consume resources, make files and increase one’s carbon 
footprint, in order for the little things to scale.

 

The above two collections of effects (41 in all) represent an interesting 
collection of what can be done with text in SVG currently (allowing for the use 
of <replicate> as frequently required for 3D effects). I hope SVG 2.0 will 
allow for the sorts of things Israel Eisenberg has been talking about at 
http://owl3d.com/svg/tests/boundText/ (stretching and distortion of glyphs).  
While SVG1 allows a single path to control the shape of the baseline, allowing 
two paths: one for baseline and the other for top alignment makes good sense.

 

These examples also provide another sort of hixie-free-koolaid test. Giving 
scores of 0, 1 or 2 for the static ones, and 0,1,2 or 3 for the animated ones, 
here’s how the browsers stack up on this particular battery of fancy font 
frivolity:

 

Total points possible:  91 (64 static and 27 animated)

 

Opera 60 + 27 = 87 (some oddities with dash-array)

Firefox 51 + 14 = 65

chrome 42 + 7 = 49

Safari 0 + 13 = 13 (note: Safari crashes on the first set, so it really isn’t 
testable)

 

IE9+ASV 43 + 20 = 63 (note, my installation of IE9 defaults to ASV when the 
<object> in HTML is of a certain type, helping, obviously with the animation 
score.

 

Another note: the browsers are penalized a point each when they don’t fit the 
text on the screen using

textLength="100"[%] lengthAdjust="spacingAndGlyphs"

 

 

So unfortunately, browsers like Firefox get overly dinged for what is really 
just one or two relatively small features.

 

Another oddity, with Opera: the pauseAnimation and unpauseAnimation are caused 
by mouseover events associated with the <object>.  If one moves from directly 
one object to another, those events are not heard. The other browsers don’t 
seem to have this problem.

 

Cheers

David

From: [email protected] [mailto:[email protected]] On 
Behalf Of Erik Dahlstrom
Sent: Friday, July 22, 2011 5:00 AM
To: [email protected]
Subject: Re: [svg-developers] finding the HTML <object> whose SVG was clicked 
upon

 

  

On Thu, 21 Jul 2011 20:29:55 +0200, David Dailey 
<[email protected] <mailto:ddailey%40zoominternet.net> > wrote:

...
> I start out with an HTML document with a bunch of <object>s each 
> containing
> a different SVG.

You could perhaps use <a href=your.svg><img src=your.svg></a> element 
instead of <object>?

> However, knowing which SVG document I have seems to reveal neither which
> particular <object> it was housed in (from which I could interrogate its
> "data" field) nor the URL containing the now selected SVG document.

What element referenced/embedded the svg is possible to find out, see this 
example:

http://xn--dahlstrm-t4a.net/svg/html/from-svg-to-parent-html-script.html

>From an element elm inside the svg that was embedded by reference:

var embedding_elm = elm.ownerDocument.defaultView.frameElement;

Cheers
-- 
Erik Dahlstrom, Core Technology Developer, Opera Software
Co-Chair, W3C SVG Working Group
Personal blog: http://my.opera.com/macdev_ed





[Non-text portions of this message have been removed]



------------------------------------

-----
To unsubscribe send a message to: [email protected]
-or-
visit http://groups.yahoo.com/group/svg-developers and click "edit my 
membership"
----Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/svg-developers/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/svg-developers/join
    (Yahoo! ID required)

<*> To change settings via email:
    [email protected] 
    [email protected]

<*> To unsubscribe from this group, send an email to:
    [email protected]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/

Reply via email to