Hello Erik,
You're right!
with Opera :
evt.target: [object SVGElementInstance]evt.currentTarget: [object
SVGUseElement]
With FFX :
evt.target: [object SVGUseElement]evt.currentTarget: [object
SVGUseElement]
So, to deal with evt, i use now :
if (typeof evt.target.id != 'undefined') // don't find a better way
to check
{
objet=evt.target.getAttributeNS(null,"id");
}
else {
objet=evt.currentTarget.getAttributeNS(null,"id");
}
Now I can fill shapes with bitmaps patterns and compare patterns with
IE, FFX and Opera : ex-equo IE and Opera, FFX shows white line at
junction(varying when zooming).
As i use svg like a simple scripting language, i find IMHO that it is
not consistent to have two different syntaxes to access to an object
(is it for secutity issues?). I see that i will have to deal with
that for groups ...
At this moment, I don't have the same behavior in each UAs, but i see
a light in the tunnel.
Many thanks Erik,
Philippe
--- In [email protected], Erik Dahlström <[EMAIL PROTECTED]> wrote:
>
> On Wed, 20 Feb 2008 00:00:42 +0100, philsvg <[EMAIL PROTECTED]> wrote:
>
> > Hello Erik,
> >
> > I had already find your example, which demonstrate only html-svg-
> > html, not svg-html-svg (IMHO).
> >
> > i found my prefered example here :
> >
> > http://svg-whiz.com/svg/interdoc/html-svg.html
> >
> > I found it using FFX, and i downloaded it on my local disk. When i
> > tested it with Opera, it doesn't work. At loading,I get "The
> > GetSVGDocument interface is not supported" message, not with FFX.
>
> Embed with svg:s in Opera 9.2x may sometimes give a non-consistent
result
> unfortunately, should work consistently in 9.5 though. Replacing
<embed>
> with <object> usually helps.
>
> > And now, trying my svg generated code working with FFX3b, with
Opera
> > I have a type mismatch error at
> > objet = evt.target.getAttributeNS(null, "id"); (syntax
recommanded in
> > http://jwatt.org/svg/authoring/ i decided to follow ... and works
> > well for FFX)
> > that i can replace by (as i can see in the example code)
> > objet_temp=evt.target;
> > objet=objet_temp.id;
>
> FF doesn't implement the SVGElementInstance DOM, so my guess is
that you
> are seeing this on elements that were <use>:d. Inspect the type of
> evt.target to see what it is, alert("evt.target: " + evt.target +
"
> evt.currentTarget: " + evt.currentTarget). Sometimes
evt.currentTarget is
> what you wanted, sometimes it's not. For example there can be cases
where
> you want to know which one (of several <use>:d instances) your
event
> occurred in, and sometimes you only want to get at the "real"
elements
> that the <use> pointed to. I hope that makes it easier to
understand :)
>
> Anyway, both of your ways of getting id:s should work just fine,
provided
> of course that you have an SVGElement or a Node, in case you have
an
> SVGElementInstance then there is no id attribute since it's a
"shadow tree
> element".
>
> By reading the SVG 1.1 spec it's clear that SVGElementInstance has
no
> getAttributeNS method on it - it doesn't implement the Node
interface,
> only the EventTarget interface. For details see:
>
> http://www.w3.org/TR/SVG11/
struct.html#InterfaceSVGElementInstance
> (definition of the SVGElementInstance interface)
> http://www.w3.org/TR/DOM-Level-2-Events/events.html#Events-
EventTarget
> (definition of the EventTarget interface)
>
> > but somewhere in my code, i have to use getAttributeNS to
parametrize
> > the attribute's name to factorize my code ... so thanks to avoid
me
> > to go deeper in that bad way ...
> >
> > I have to work more to be compliant with Opera ... So it is late
now
>
> I agree that it's unfortunate that Firefox implements <use>
incorrectly,
> since it hurts interoperability, but perhaps this can be fixed in
time for
> the FF3.0 final version? That SVGElementInstance isn't implemented
is one
> thing, that FF by cloning nodes instead of "conceptually cloning
nodes"
> also has side-effects such as the fact that CSS selectors applies
to the
> shadow trees (which the spec tells you they must not). The SVG 1.1
> testsuite didn't have any tests covering these cases though, but
such
> tests will no doubt be added for future releases.
>
> Cheers
> /Erik
>
> --
> Erik Dahlstrom, Core Technology Developer, Opera Software
> Co-Chair, W3C SVG Working Group
> Personal blog: http://my.opera.com/macdev_ed
>
-----
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:
mailto:[EMAIL PROTECTED]
mailto:[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/