I wouldn't recommend it, but you could get the outerHTML of the
element and use regex to parse the tag for any attributes.

Nobody's picnic, but doable.  If the attributes can be arbitrary names
there really would be no choice.

var outerhtm = // copy the element into another, and get the parents
inner html
outerHTM.match(/<(?:"[^"]*"['"]*|'[^']*'['"]*|[^'">])+>/); //from the
stackoverflow post on not using regexs

Bear in mind that IE makes all paths absolute, no matter how you read
the attributes, I know of no way to stop that.

Sam

On Mar 14, 5:36 am, duclet <[email protected]> wrote:
> Yeah, I was trying to stay away from doing that since if my memory
> serves me correct, there were some problems with it in IE. But it
> seems like there isn't any other methods though.
>
> On Mar 13, 12:58 pm, Fábio M. Costa <[email protected]> wrote:
>
> > theres no moo way of doing this.
>
> > You can do a for on the attributes collection.
>
> > var elAttributes = el.attributes;
> > for(i = 0, attr; i < elAttributes.length; i++){
> >   attr = el.attributes[i];
> >   if(attr.nodeValue) console.log(attr.nodeName, ' : ', attr.nodeValue);
>
> > }
>
> > something like this (untested).
>
> > --
> > Fábio Miranda Costa
> > Solucione Sistemas
> > Engenheiro de interfaces
>
> > On Sat, Mar 13, 2010 at 2:53 PM, Oskar Krawczyk 
> > <[email protected]>wrote:
>
> > > Pre-set all possible attributes and do *el.getProperties('title', 'href',
> > > 'rel', ...);*
>
> > > On 2 Mar 2010, at 18:06, duclet wrote:
>
> > > What would be the Moo way of getting all the attributes of an element
> > > if you don't know ahead of time what the possible attribute names are?
>
>

Reply via email to