Thanks again, you're right the documentation is a good reference. I've read it
now. I see I wasn't thinking clearly yesterday, Camerons example showed I
should have used "m" and uppercase.
My function now returns a sequence of sequences of dictionaries, great progress
haha :).
At the moment the dict only contains key-value mappings with numbers as the
value.
This is because I still can't get the Element to be returned.
This is what I have at the moment:
dictionary myFunctionElementInfo {
Node node;
};
Then when I try to assign it, I get this error:
8:10.55 In file included from /build/dom/base/Unified_cpp_dom_base5.cpp:92:
8:10.55 /source/release/dom/base/nsDocument.cpp:3580:18: error: no viable
overloaded '='
8:10.55 e->mNode = node;
8:10.55 ~~~~~~~~ ^ ~~~~
8:10.55 /build/dist/include/mozilla/dom/BindingDeclarations.h:297:7: note:
candidate function (the implicit copy assignment operator) not viable: no known
conversion from 'nsIContent *' to 'const
mozilla::dom::Optional<mozilla::OwningNonNull<nsINode> >' for 1st argument
8:10.55 class Optional<OwningNonNull<T> > : public Optional_base<T,
OwningNonNull<T> >
8:10.55 ^
8:11.94 1 error generated.
I understood from your reply that I should make the Node variable required. But
the documentation doesn't show how this works. I've tried some other things,
like Nullable<Node> but that didn't seem to solve it.
Also, before I said node but I actually want to return an Element, just like
ElementsFromPoint(). But for some reason I'm not allowed to have a dictionary
item with type Element... compiling works with Node but not with Element...
This compiles:
dictionary myFunctionElementInfo {
Node node;
};
This doesn't:
dictionary myFunctionElementInfo {
Element element;
};
It gives many errors similar to this:
0:12.03 /build/dist/include/mozilla/dom/Element.h:810:12: error: incomplete
type 'nsPresContext' named in nested name specifier
0:12.03
nsPresContext::AppUnitsToIntCSSPixels(sf->GetScrollRange().XMost()) :
0:12.03 ^~~~~~~~~~~~~~~
I'm not sure if I need Node or Element in my case, I just want to return the
HTML elements so I can do more with them on the JavaScript side. The return
value of ElementsFromPoint() is what I'm after, so that's why I think I need to
use Element instead of Node.
_______________________________________________
dev-tech-layout mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-layout