以下将不起作用,因为边是 aDom.nodeList
并且DomTokenList.forEach
期望 a Dom.domTokenList
。
open Bs_webapi.Dom;
external length : Dom.nodeList => int = "" [@@bs.get];
let sides = Document.querySelectorAll "#carousel > figure" document;
DomTokenList.forEach (fun item _ => print_endline item) (sides);