Using Firefox 34 and addon SDK 1.17.
I am using the HTML version of the SDK to add content to a script. Inside the contents of the script, I see very strange behavior when trying to access DOM elements.
main.js
pageMod.PageMod({
include: "somewebsite",
contentScriptWhen: 'end',
contentScriptFile: [data.url("stuff.js")]
});
stuff.js
log(document.getElementsByTagName("body"));
log(document.getElementById("SomeIdThatShouldBeThere"));
log(document.getElementsByTagName("li"));
This will work as expected:
document.body.style.border = "5px solid red";
Also for the empty objects that I get, I can do
obj.style.border = ...
and it will work, the html element will be modified to change the border color, etc. But I can not read the properties of the elements, so I work blindly.
I read that people say that there are some restrictions on modifying the DOM from content scripts, but I can't do even the most basic thing, apparently. Is this supposed to be supported or not?
edit: , , , - ... , , , .