Document.getElementById ?
-
on a mac, both of these work...
is that the same on other PC variants...d.execute_script %Q(document.getElementById('trans_L8').value='Translate';)
d.execute_script %Q(trans_L8.value='Translate';)
john
-
Well, it's something basic one expects from all browsers to work. Not a question of operating system.
But I usedocument.getElementById
a lot (or frameworks using it) and it works, in IE, even the old IE6.
Whether you can use.value=
depends on what type of element you access (HTMLInputElement
?). -
the question is about the shorthand access inside a Webdialog, so WebKit v IE...
I find it cleaner without document string element...
and when generating dynamically the files smaller, so should be faster?
so, to rephrase, can IE handle the shorthand for any attribute, value/name/title etc...
john
-
My quick test with Sketchup v2014, IE 11 shows that both forms work. Have no information about other versions.
-
cheers Gábor,
I have a lot of them and the shorter the better...
john
-
@driven said:
cheers Gábor,
I have a lot of them and the shorter the better...
john
I've entered the following lines in to the ruby console for the test:
` dlg = UI::WebDialog.new("TEST", true,"TEST", 739, 641, 150, 150, true);#UI::WebDialog:0xb4e49d8
dlg.set_html('<html><head></head><body><div id="trans_L8"></div></body></html>')
nil
dlg.show
true
dlg.execute_script %Q(document.getElementById('trans_L8').innerHTML='Long';)
true
dlg.execute_script %Q(trans_L8.innerHTML='Short';)
true`
If somebody wants to try it with other version combinations... -
or select all...
dlg = UI;;WebDialog.new("TEST", true,"TEST", 739, 641, 150, 150, true); dlg.set_html('<html><head></head><body><div id="trans_L8"></div></body></html>') dlg.show
dlg.execute_script %Q(document.getElementById('trans_L8').innerHTML='Long';)
dlg.execute_script %Q(trans_L8.innerHTML='Short';)
on mac you need to split it twice... but I know it works on mac...lol
john -
Thank you for the formatting. The splitted version works on PC, IE11, SU 2014.
Advertisement