Easier to use mango.css helper method

This commit is contained in:
Alex Ling 2020-07-24 05:11:13 +00:00
parent 9ea26474b4
commit 2a910335af

View File

@ -251,9 +251,14 @@ class Plugin
selector = env.require_string 1
myhtml = Myhtml::Parser.new html
json = myhtml.css(selector).map(&.to_html).to_a.to_json
ary = myhtml.css(selector).map(&.to_html).to_a
ary_idx = env.push_array
ary.each_with_index do |str, i|
env.push_string str
env.put_prop_index ary_idx, i.to_u32
end
env.push_string json
env.call_success
end
sbx.put_prop_string -2, "css"