開く
開く
開く
開く
{"ScriptPreparationCode":null,"TestCases":[{"Name":"container from","Code":"class Tooltip {\r\n constructor(container) {\r\n this.container = container;\r\n this.opener = this.container.getElementsByClassName(\u0027js-tooltip-opener\u0027)[0];\r\n this.self = this.container.getElementsByClassName(\u0027js-tooltip\u0027)[0];\r\n }\r\n}\r\n\r\nconst containers = Array.from(document.getElementsByClassName(\u0027js-tooltip-container\u0027))\r\ncontainers.forEach(container =\u003Enew Tooltip(container))\r\n","IsDeferred":false},{"Name":"from tooltips","Code":"class Tooltip {\r\n constructor(tooltip) {\r\n this.self = tooltip;\r\n const openers = Array.from(document.getElementsByClassName(\u0027js-tooltip-opener\u0027))\r\n this.opener = openers.filter((opener) =\u003E opener.getAttribute(\u0060[aria-controls=\u0022${this.self.id}\u0022]\u0060))[0];\r\n }\r\n}\r\n\r\nconst tooltips = Array.from(document.getElementsByClassName(\u0027js-tooltip\u0027))\r\ntooltips.forEach(tooltip =\u003Enew Tooltip(tooltip))","IsDeferred":false},{"Name":"from tooltips 2","Code":"class Tooltip {\r\n constructor(tooltip) {\r\n this.self = tooltip;\r\n this.opener = document.querySelector(\u0060[aria-controls=\u0022${this.self.id}\u0022]\u0060)[0];\r\n }\r\n}\r\n\r\nconst tooltips = Array.from(document.getElementsByClassName(\u0027js-tooltip\u0027))\r\ntooltips.forEach(tooltip =\u003Enew Tooltip(tooltip))","IsDeferred":false}]}