From: Robin B. <ro...@kn...> - 2001-09-18 17:38:31
|
On Tuesday 18 September 2001 19:32, Antoine Quint wrote: > > This is extremely expensive, are you sure there's no better > > way ? Wouldn't > > you be able to specify the targets on the gradient or > > something like that ? > > > > <i:gradient> > > <i:target xlink:href='#foo'> > > <i:target xlink:href='#bar'> > > </i:gradient> > > Of course, I could do that... But I really want to keep it as simple as > possible, and since there was a way to avoid doing this... I think the best aproach is: make it work first, then think about making it simpler. I don't think people care about having to add (most likely cutnpaste) a few elements. If there is a better, not too expensive, way we can always add it later on as extra sugar. > I may rethink the syntax then. How about doing: > > <rect style="fill:url(#my_gradient)"> > <i:gradient xlink:href="#k_gradient"> > <i:target xlink:href="#target" attributeName="fill" /> > <i:target xlink:href="#target" attributeName="stroke" /> > <i:target xlink:href="#coords" attributeName="fill" /> > </i:gradient> > </rect> > > This way we would now what is the gradient holder (the parent node). Looks good to me. > A dirty trick works sometimes, and that is checking > hasAttribute('style'), but it completely defeats the purpose of CSS > since this would not support cascading. The eval way might well be the > least awful option. I vote against hasAttribute, it does indeed totally defeat everything that we belive in. It is weak and without honour. Give element.prototype.hasOwnProperty('style') a try, and then go for eval. You might want to check the elements' interfaces for other clues: var props = ''; for (p in element) { props += p + ': ' + element[p] + "\n"; } alert(props); -- _______________________________________________________________________ Robin Berjon <ro...@kn...> -- CTO k n o w s c a p e : // venture knowledge agency www.knowscape.com ----------------------------------------------------------------------- An eye for an eye will make the whole world blind. -- Mahatma Gandhi |