ownerDoc()
功能
获取指定元素的所有者文档对象。
语法
noder.ownerDoc(elm)
参数
- elm
HTMLElement对象,指定对象HTML元素
范例
Example:查找p元素后再 ownerDoc body,修改body的背景色。
<!DOCTYPE html> <html> <head> <style> </style> <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.3/require.min.js"></script> <script> require.config({ baseUrl: "./", packages: [{ name: "skylark", location: "../../../src/skylark" }, ] }); </script> </head> <body> <p>Hello</p> <script> require(["skylark/query", "skylark/noder"], function($, noder) { $(noder.ownerDoc($("p")[0]).body).style("background","green"); }); </script> </body> </html>