lib/isomorfeus/puppetmaster/driver/puppeteer_node.rb in isomorfeus-puppetmaster-0.2.7 vs lib/isomorfeus/puppetmaster/driver/puppeteer_node.rb in isomorfeus-puppetmaster-0.2.8
- old
+ new
@@ -295,11 +295,11 @@
end
def node_evaluate_script(node, script, *args)
await <<~JAVASCRIPT
var node_handle = #{node.handle};
- await AllElementHandles[node_handle].executionContext().evaluateHandle((node, arguments) => {
+ handle = await AllElementHandles[node_handle].executionContext().evaluateHandle((node, arguments) => {
arguments.unshift(node);
return #{script};
}, AllElementHandles[node_handle], #{args[1..-1]});
LastResult = await handle.jsonValue();
JAVASCRIPT
@@ -569,16 +569,10 @@
end
def node_style(node, *styles)
await <<~JAVASCRIPT
var handle = await AllElementHandles[#{node.handle}].executionContext().evaluateHandle(function(node, styles){
- var style = window.getComputedStyle(node);
- if (styles.length > 0) {
- return styles.reduce(function(res,name) {
- res[name] = style[name];
- return res;
- }, {});
- } else { return style; }
+ return = window.getComputedStyle(node);
}, AllElementHandles[#{node.handle}], #{styles});
LastResult = await handle.jsonValue();
JAVASCRIPT
end