问题
Does Gecko expose an API for working directly with its DOM? I'm looking for a class like HtmlElement that can be used to build/traverse trees of HTML content.
I'm trying to host Gecko as a web browser control in a desktop application, and would prefer a direct API rather than going through COM. Thanks!
回答1:
Yes, virtually all of the classes relating to the DOM are exposed through XPCOM. In fact, I believe the entire functionality of Gecko is exposed this way.
回答2:
greyfade: whilst your answer is technically correct, i've found that the gecko DOM API is incredibly hard to find, because of all the javascript-based answers that keep popping up with a higher priority!
XPCOM is also really quite hard to understand, as it is functionally nearly 90% the same as COM.
you really want to get onto the mozilla dev platform newsgroup and ask this question: you're more likely to get answers from there, as the people who actually use XPCOM from c++ tend to accumulate around that newsgroup.
l.
来源:https://stackoverflow.com/questions/563996/gecko-api-for-dom