Detecting Microformats in the parser

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Detecting Microformats in the parser

Michael Kaply-2
Need some help/opinons.

I need to figure out what to do in the parser for microformats and get
some traction on:

https://bugzilla.mozilla.org/show_bug.cgi?id=377450

Basically there are the issues that I need some help/thought/discussion on.

1. Does Microformats need to be a component (vs. the JS module it is
now) so that the list of microformat class names can be queried by the
parser? Can we come up with some other way for the Microformats module
to notify the parser of class names?

2. Where do we add microformat detection to the parser? During parsing?
Or at the end does it look at the classes for a given document?

3. How do we notify that there are microformats available? Do we use an
event similar to the <link> tag? Or do we set some attribute on a
document to indicate that microformats are available?

I have zero experience in this code, so I'm really looking for some
outside help.

Anything would be appreciated.

Thanks!

Mike Kaply
_______________________________________________
dev-tech-dom mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-dom
Reply | Threaded
Open this post in threaded view
|

Re: Detecting Microformats in the parser

Boris Zbarsky
Michael Kaply wrote:
> 1. Does Microformats need to be a component (vs. the JS module it is
> now) so that the list of microformat class names can be queried by the
> parser? Can we come up with some other way for the Microformats module
> to notify the parser of class names?
>
> 2. Where do we add microformat detection to the parser? During parsing?
> Or at the end does it look at the classes for a given document?

Note that the list of classes is not really available in the parser.  Class
attribute parsing happens in nsAttrValue, basically.

What sort of information are you trying to extract?  Just that some class
somewhere on the page matches something in your list?

And are you trying to handle dynamic changes too?

The simplest impl would compare to the list when setting a class attr, but I'm a
little worried about performance impact...

> 3. How do we notify that there are microformats available? Do we use an
> event similar to the <link> tag?

If we do, we shouldn't fire the event until DOMContentLoaded, imo.  All we need
is an event saying yes, right?  We don't need an event for every microformat
instance...

-Boris

_______________________________________________
dev-tech-dom mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-dom
Reply | Threaded
Open this post in threaded view
|

Re: Detecting Microformats in the parser

Michael Kaply-2
Boris Zbarsky wrote:

> Michael Kaply wrote:
>> 1. Does Microformats need to be a component (vs. the JS module it is
>> now) so that the list of microformat class names can be queried by the
>> parser? Can we come up with some other way for the Microformats module
>> to notify the parser of class names?
>>
>> 2. Where do we add microformat detection to the parser? During parsing?
>> Or at the end does it look at the classes for a given document?
>
> Note that the list of classes is not really available in the parser.  
> Class attribute parsing happens in nsAttrValue, basically.
>
> What sort of information are you trying to extract?  Just that some
> class somewhere on the page matches something in your list?

Yep, all we're looking for is the knowledge that a class matches
something on the list.

> And are you trying to handle dynamic changes too?

I'd like to if possible. Not sure how difficult that would be...

> The simplest impl would compare to the list when setting a class attr,
> but I'm a little worried about performance impact...
>
>> 3. How do we notify that there are microformats available? Do we use an
>> event similar to the <link> tag?
>
> If we do, we shouldn't fire the event until DOMContentLoaded, imo.  All
> we need is an event saying yes, right?  We don't need an event for every
> microformat instance...

Nope, we just need one event saying there are microformats. Or a way to
ask a document on DOMCOntentLoaded if it has microformats.

Note that DOMContentLoaded is not received everytime a page loads, so
that's kind of problem (back button comes to mind)

Mike
_______________________________________________
dev-tech-dom mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-dom