3 <html lang=
"en" class=
"no-js">
7 <meta name=
"viewport" content=
"width=device-width,initial-scale=1">
12 <link rel=
"shortcut icon" href=
"../../assets/default.favicon.ico">
13 <meta name=
"generator" content=
"mkdocs-1.1.2, mkdocs-material-7.0.3">
17 <title>DOM - WoltLab Suite Documentation
</title>
21 <link rel=
"stylesheet" href=
"../../assets/stylesheets/main.1655a90d.min.css">
24 <link rel=
"stylesheet" href=
"../../assets/stylesheets/palette.7fa14f5b.min.css">
28 <meta name=
"theme-color" content=
"#009485">
37 <link rel=
"stylesheet" href=
"../../stylesheets/extra.css">
51 <body dir=
"ltr" data-md-color-scheme=
"" data-md-color-primary=
"teal" data-md-color-accent=
"">
55 <input class=
"md-toggle" data-md-toggle=
"drawer" type=
"checkbox" id=
"__drawer" autocomplete=
"off">
56 <input class=
"md-toggle" data-md-toggle=
"search" type=
"checkbox" id=
"__search" autocomplete=
"off">
57 <label class=
"md-overlay" for=
"__drawer"></label>
58 <div data-md-component=
"skip">
61 <a href=
"#working-with-the-dom-javascript-api" class=
"md-skip">
66 <div data-md-component=
"announce">
68 <aside class=
"md-announce">
69 <div class=
"md-announce__inner md-grid md-typeset">
71 <a href=
"https://www.woltlab.com">Back to
<strong>woltlab.com
</strong></a>
80 <header class=
"md-header" data-md-component=
"header">
81 <nav class=
"md-header__inner md-grid" aria-label=
"Header">
82 <a href=
"../.." title=
"WoltLab Suite Documentation" class=
"md-header__button md-logo" aria-label=
"WoltLab Suite Documentation">
84 <img src=
"../../assets/logo.png" alt=
"logo">
87 <label class=
"md-header__button md-icon" for=
"__drawer">
88 <svg xmlns=
"http://www.w3.org/2000/svg" viewBox=
"0 0 24 24"><path d=
"M3 6h18v2H3V6m0 5h18v2H3v-2m0 5h18v2H3v-2z"/></svg>
90 <div class=
"md-header__title" data-md-component=
"header-title">
91 <div class=
"md-header__ellipsis">
92 <div class=
"md-header__topic">
93 <span class=
"md-ellipsis">
94 WoltLab Suite Documentation
97 <div class=
"md-header__topic" data-md-component=
"header-topic">
98 <span class=
"md-ellipsis">
106 <div class=
"md-header__options">
110 <label class=
"md-header__button md-icon" for=
"__search">
111 <svg xmlns=
"http://www.w3.org/2000/svg" viewBox=
"0 0 24 24"><path d=
"M9.5 3A6.5 6.5 0 0 1 16 9.5c0 1.61-.59 3.09-1.56 4.23l.27.27h.79l5 5-1.5 1.5-5-5v-.79l-.27-.27A6.516 6.516 0 0 1 9.5 16 6.5 6.5 0 0 1 3 9.5 6.5 6.5 0 0 1 9.5 3m0 2C7 5 5 7 5 9.5S7 14 9.5 14 14 12 14 9.5 12 5 9.5 5z"/></svg>
114 <div class=
"md-search" data-md-component=
"search" role=
"dialog">
115 <label class=
"md-search__overlay" for=
"__search"></label>
116 <div class=
"md-search__inner" role=
"search">
117 <form class=
"md-search__form" name=
"search">
118 <input type=
"text" class=
"md-search__input" name=
"query" aria-label=
"Search" placeholder=
"Search" autocapitalize=
"off" autocorrect=
"off" autocomplete=
"off" spellcheck=
"false" data-md-component=
"search-query" data-md-state=
"active" required
>
119 <label class=
"md-search__icon md-icon" for=
"__search">
120 <svg xmlns=
"http://www.w3.org/2000/svg" viewBox=
"0 0 24 24"><path d=
"M9.5 3A6.5 6.5 0 0 1 16 9.5c0 1.61-.59 3.09-1.56 4.23l.27.27h.79l5 5-1.5 1.5-5-5v-.79l-.27-.27A6.516 6.516 0 0 1 9.5 16 6.5 6.5 0 0 1 3 9.5 6.5 6.5 0 0 1 9.5 3m0 2C7 5 5 7 5 9.5S7 14 9.5 14 14 12 14 9.5 12 5 9.5 5z"/></svg>
121 <svg xmlns=
"http://www.w3.org/2000/svg" viewBox=
"0 0 24 24"><path d=
"M20 11v2H8l5.5 5.5-1.42 1.42L4.16 12l7.92-7.92L13.5 5.5 8 11h12z"/></svg>
123 <button type=
"reset" class=
"md-search__icon md-icon" aria-label=
"Clear" tabindex=
"-1">
124 <svg xmlns=
"http://www.w3.org/2000/svg" viewBox=
"0 0 24 24"><path d=
"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"/></svg>
127 <div class=
"md-search__output">
128 <div class=
"md-search__scrollwrap" data-md-scrollfix
>
129 <div class=
"md-search-result" data-md-component=
"search-result">
130 <div class=
"md-search-result__meta">
133 <ol class=
"md-search-result__list"></ol>
144 <div class=
"md-container" data-md-component=
"container">
149 <main class=
"md-main" data-md-component=
"main">
150 <div class=
"md-main__inner md-grid">
154 <div class=
"md-sidebar md-sidebar--primary" data-md-component=
"sidebar" data-md-type=
"navigation" >
155 <div class=
"md-sidebar__scrollwrap">
156 <div class=
"md-sidebar__inner">
162 <nav class=
"md-nav md-nav--primary" aria-label=
"Navigation" data-md-level=
"0">
163 <label class=
"md-nav__title" for=
"__drawer">
164 <a href=
"../.." title=
"WoltLab Suite Documentation" class=
"md-nav__button md-logo" aria-label=
"WoltLab Suite Documentation">
166 <img src=
"../../assets/logo.png" alt=
"logo">
169 WoltLab Suite Documentation
172 <ul class=
"md-nav__list" data-md-scrollfix
>
181 <li class=
"md-nav__item">
182 <a href=
"../../getting-started/" class=
"md-nav__link">
197 <li class=
"md-nav__item md-nav__item--nested">
200 <input class=
"md-nav__toggle md-toggle" data-md-toggle=
"__nav_2" type=
"checkbox" id=
"__nav_2" >
202 <label class=
"md-nav__link" for=
"__nav_2">
204 <span class=
"md-nav__icon md-icon"></span>
206 <nav class=
"md-nav" aria-label=
"PHP API" data-md-level=
"1">
207 <label class=
"md-nav__title" for=
"__nav_2">
208 <span class=
"md-nav__icon md-icon"></span>
211 <ul class=
"md-nav__list" data-md-scrollfix
>
217 <li class=
"md-nav__item">
218 <a href=
"../../php/pages/" class=
"md-nav__link">
229 <li class=
"md-nav__item">
230 <a href=
"../../php/database-objects/" class=
"md-nav__link">
241 <li class=
"md-nav__item">
242 <a href=
"../../php/database-access/" class=
"md-nav__link">
253 <li class=
"md-nav__item">
254 <a href=
"../../php/exceptions/" class=
"md-nav__link">
266 <li class=
"md-nav__item md-nav__item--nested">
269 <input class=
"md-nav__toggle md-toggle" data-md-toggle=
"__nav_2_5" type=
"checkbox" id=
"__nav_2_5" >
271 <label class=
"md-nav__link" for=
"__nav_2_5">
273 <span class=
"md-nav__icon md-icon"></span>
275 <nav class=
"md-nav" aria-label=
"API" data-md-level=
"2">
276 <label class=
"md-nav__title" for=
"__nav_2_5">
277 <span class=
"md-nav__icon md-icon"></span>
280 <ul class=
"md-nav__list" data-md-scrollfix
>
286 <li class=
"md-nav__item">
287 <a href=
"../../php/api/caches/" class=
"md-nav__link">
298 <li class=
"md-nav__item">
299 <a href=
"../../php/api/comments/" class=
"md-nav__link">
310 <li class=
"md-nav__item">
311 <a href=
"../../php/api/cronjobs/" class=
"md-nav__link">
322 <li class=
"md-nav__item">
323 <a href=
"../../php/api/events/" class=
"md-nav__link">
335 <li class=
"md-nav__item md-nav__item--nested">
338 <input class=
"md-nav__toggle md-toggle" data-md-toggle=
"__nav_2_5_5" type=
"checkbox" id=
"__nav_2_5_5" >
340 <label class=
"md-nav__link" for=
"__nav_2_5_5">
342 <span class=
"md-nav__icon md-icon"></span>
344 <nav class=
"md-nav" aria-label=
"Form Builder" data-md-level=
"3">
345 <label class=
"md-nav__title" for=
"__nav_2_5_5">
346 <span class=
"md-nav__icon md-icon"></span>
349 <ul class=
"md-nav__list" data-md-scrollfix
>
355 <li class=
"md-nav__item">
356 <a href=
"../../php/api/form_builder/overview/" class=
"md-nav__link">
367 <li class=
"md-nav__item">
368 <a href=
"../../php/api/form_builder/structure/" class=
"md-nav__link">
379 <li class=
"md-nav__item">
380 <a href=
"../../php/api/form_builder/form_fields/" class=
"md-nav__link">
391 <li class=
"md-nav__item">
392 <a href=
"../../php/api/form_builder/validation_data/" class=
"md-nav__link">
403 <li class=
"md-nav__item">
404 <a href=
"../../php/api/form_builder/dependencies/" class=
"md-nav__link">
421 <li class=
"md-nav__item">
422 <a href=
"../../php/api/package_installation_plugins/" class=
"md-nav__link">
423 Package Installation Plugins
433 <li class=
"md-nav__item">
434 <a href=
"../../php/api/user_activity_points/" class=
"md-nav__link">
445 <li class=
"md-nav__item">
446 <a href=
"../../php/api/user_notifications/" class=
"md-nav__link">
457 <li class=
"md-nav__item">
458 <a href=
"../../php/api/sitemaps/" class=
"md-nav__link">
475 <li class=
"md-nav__item">
476 <a href=
"../../php/code-style/" class=
"md-nav__link">
487 <li class=
"md-nav__item">
488 <a href=
"../../php/apps/" class=
"md-nav__link">
499 <li class=
"md-nav__item">
500 <a href=
"../../php/gdpr/" class=
"md-nav__link">
521 <li class=
"md-nav__item md-nav__item--nested">
524 <input class=
"md-nav__toggle md-toggle" data-md-toggle=
"__nav_3" type=
"checkbox" id=
"__nav_3" >
526 <label class=
"md-nav__link" for=
"__nav_3">
527 Languages, Templates & CSS
528 <span class=
"md-nav__icon md-icon"></span>
530 <nav class=
"md-nav" aria-label=
"Languages, Templates & CSS" data-md-level=
"1">
531 <label class=
"md-nav__title" for=
"__nav_3">
532 <span class=
"md-nav__icon md-icon"></span>
533 Languages, Templates & CSS
535 <ul class=
"md-nav__list" data-md-scrollfix
>
541 <li class=
"md-nav__item">
542 <a href=
"../../view/languages/" class=
"md-nav__link">
553 <li class=
"md-nav__item">
554 <a href=
"../../view/templates/" class=
"md-nav__link">
565 <li class=
"md-nav__item">
566 <a href=
"../../view/css/" class=
"md-nav__link">
589 <li class=
"md-nav__item md-nav__item--active md-nav__item--nested">
592 <input class=
"md-nav__toggle md-toggle" data-md-toggle=
"__nav_4" type=
"checkbox" id=
"__nav_4" checked
>
594 <label class=
"md-nav__link" for=
"__nav_4">
596 <span class=
"md-nav__icon md-icon"></span>
598 <nav class=
"md-nav" aria-label=
"JavaScript API" data-md-level=
"1">
599 <label class=
"md-nav__title" for=
"__nav_4">
600 <span class=
"md-nav__icon md-icon"></span>
603 <ul class=
"md-nav__list" data-md-scrollfix
>
609 <li class=
"md-nav__item">
610 <a href=
"../general-usage/" class=
"md-nav__link">
624 <li class=
"md-nav__item md-nav__item--active md-nav__item--nested">
627 <input class=
"md-nav__toggle md-toggle" data-md-toggle=
"__nav_4_2" type=
"checkbox" id=
"__nav_4_2" checked
>
629 <label class=
"md-nav__link" for=
"__nav_4_2">
631 <span class=
"md-nav__icon md-icon"></span>
633 <nav class=
"md-nav" aria-label=
"New API" data-md-level=
"2">
634 <label class=
"md-nav__title" for=
"__nav_4_2">
635 <span class=
"md-nav__icon md-icon"></span>
638 <ul class=
"md-nav__list" data-md-scrollfix
>
644 <li class=
"md-nav__item">
645 <a href=
"../new-api_writing-a-module/" class=
"md-nav__link">
656 <li class=
"md-nav__item">
657 <a href=
"../new-api_data-structures/" class=
"md-nav__link">
668 <li class=
"md-nav__item">
669 <a href=
"../new-api_core/" class=
"md-nav__link">
682 <li class=
"md-nav__item md-nav__item--active">
684 <input class=
"md-nav__toggle md-toggle" data-md-toggle=
"toc" type=
"checkbox" id=
"__toc">
689 <label class=
"md-nav__link md-nav__link--active" for=
"__toc">
691 <span class=
"md-nav__icon md-icon"></span>
694 <a href=
"./" class=
"md-nav__link md-nav__link--active">
699 <nav class=
"md-nav md-nav--secondary" aria-label=
"Table of contents">
705 <label class=
"md-nav__title" for=
"__toc">
706 <span class=
"md-nav__icon md-icon"></span>
709 <ul class=
"md-nav__list" data-md-component=
"toc" data-md-scrollfix
>
711 <li class=
"md-nav__item">
712 <a href=
"#helper-functions" class=
"md-nav__link">
718 <li class=
"md-nav__item">
719 <a href=
"#domutil" class=
"md-nav__link">
723 <nav class=
"md-nav" aria-label=
"Dom/Util">
724 <ul class=
"md-nav__list">
726 <li class=
"md-nav__item">
727 <a href=
"#createfragmentfromhtmlhtml-string-documentfragment" class=
"md-nav__link">
728 createFragmentFromHtml(html: string): DocumentFragment
733 <li class=
"md-nav__item">
734 <a href=
"#identifyelement-element-string" class=
"md-nav__link">
735 identify(element: Element): string
740 <li class=
"md-nav__item">
741 <a href=
"#outerheightelement-element-styles-cssstyledeclaration-number" class=
"md-nav__link">
742 outerHeight(element: Element, styles?: CSSStyleDeclaration): number
747 <li class=
"md-nav__item">
748 <a href=
"#outerwidthelement-element-styles-cssstyledeclaration-number" class=
"md-nav__link">
749 outerWidth(element: Element, styles?: CSSStyleDeclaration): number
754 <li class=
"md-nav__item">
755 <a href=
"#outerdimensionselement-element-height-number-width-number" class=
"md-nav__link">
756 outerDimensions(element: Element): { height: number, width: number }
761 <li class=
"md-nav__item">
762 <a href=
"#offsetelement-element-top-number-left-number" class=
"md-nav__link">
763 offset(element: Element): { top: number, left: number }
768 <li class=
"md-nav__item">
769 <a href=
"#setinnerhtmlelement-element-innerhtml-string" class=
"md-nav__link">
770 setInnerHtml(element: Element, innerHtml: string)
775 <li class=
"md-nav__item">
776 <a href=
"#containselement-element-child-element-boolean" class=
"md-nav__link">
777 contains(element: Element, child: Element): boolean
782 <li class=
"md-nav__item">
783 <a href=
"#unwrapchildnodeselement-element" class=
"md-nav__link">
784 unwrapChildNodes(element: Element)
794 <li class=
"md-nav__item">
795 <a href=
"#domchangelistener" class=
"md-nav__link">
813 <li class=
"md-nav__item">
814 <a href=
"../new-api_events/" class=
"md-nav__link">
825 <li class=
"md-nav__item">
826 <a href=
"../new-api_ajax/" class=
"md-nav__link">
837 <li class=
"md-nav__item">
838 <a href=
"../new-api_dialogs/" class=
"md-nav__link">
849 <li class=
"md-nav__item">
850 <a href=
"../new-api_browser/" class=
"md-nav__link">
851 Browser and Screen Sizes
861 <li class=
"md-nav__item">
862 <a href=
"../new-api_ui/" class=
"md-nav__link">
879 <li class=
"md-nav__item">
880 <a href=
"../legacy-api/" class=
"md-nav__link">
891 <li class=
"md-nav__item">
892 <a href=
"../helper-functions/" class=
"md-nav__link">
903 <li class=
"md-nav__item">
904 <a href=
"../code-snippets/" class=
"md-nav__link">
925 <li class=
"md-nav__item md-nav__item--nested">
928 <input class=
"md-nav__toggle md-toggle" data-md-toggle=
"__nav_5" type=
"checkbox" id=
"__nav_5" >
930 <label class=
"md-nav__link" for=
"__nav_5">
932 <span class=
"md-nav__icon md-icon"></span>
934 <nav class=
"md-nav" aria-label=
"Package Components" data-md-level=
"1">
935 <label class=
"md-nav__title" for=
"__nav_5">
936 <span class=
"md-nav__icon md-icon"></span>
939 <ul class=
"md-nav__list" data-md-scrollfix
>
945 <li class=
"md-nav__item">
946 <a href=
"../../package/package-xml/" class=
"md-nav__link">
958 <li class=
"md-nav__item md-nav__item--nested">
961 <input class=
"md-nav__toggle md-toggle" data-md-toggle=
"__nav_5_2" type=
"checkbox" id=
"__nav_5_2" >
963 <label class=
"md-nav__link" for=
"__nav_5_2">
965 <span class=
"md-nav__icon md-icon"></span>
967 <nav class=
"md-nav" aria-label=
"PIPs" data-md-level=
"2">
968 <label class=
"md-nav__title" for=
"__nav_5_2">
969 <span class=
"md-nav__icon md-icon"></span>
972 <ul class=
"md-nav__list" data-md-scrollfix
>
978 <li class=
"md-nav__item">
979 <a href=
"../../package/pip/" class=
"md-nav__link">
990 <li class=
"md-nav__item">
991 <a href=
"../../package/pip/acl-option/" class=
"md-nav__link">
1002 <li class=
"md-nav__item">
1003 <a href=
"../../package/pip/acp-menu/" class=
"md-nav__link">
1014 <li class=
"md-nav__item">
1015 <a href=
"../../package/pip/acp-search-provider/" class=
"md-nav__link">
1026 <li class=
"md-nav__item">
1027 <a href=
"../../package/pip/acp-template/" class=
"md-nav__link">
1038 <li class=
"md-nav__item">
1039 <a href=
"../../package/pip/bbcode/" class=
"md-nav__link">
1050 <li class=
"md-nav__item">
1051 <a href=
"../../package/pip/box/" class=
"md-nav__link">
1062 <li class=
"md-nav__item">
1063 <a href=
"../../package/pip/clipboard-action/" class=
"md-nav__link">
1074 <li class=
"md-nav__item">
1075 <a href=
"../../package/pip/core-object/" class=
"md-nav__link">
1086 <li class=
"md-nav__item">
1087 <a href=
"../../package/pip/cronjob/" class=
"md-nav__link">
1098 <li class=
"md-nav__item">
1099 <a href=
"../../package/pip/event-listener/" class=
"md-nav__link">
1110 <li class=
"md-nav__item">
1111 <a href=
"../../package/pip/file/" class=
"md-nav__link">
1122 <li class=
"md-nav__item">
1123 <a href=
"../../package/pip/language/" class=
"md-nav__link">
1134 <li class=
"md-nav__item">
1135 <a href=
"../../package/pip/media-provider/" class=
"md-nav__link">
1146 <li class=
"md-nav__item">
1147 <a href=
"../../package/pip/menu/" class=
"md-nav__link">
1158 <li class=
"md-nav__item">
1159 <a href=
"../../package/pip/menu-item/" class=
"md-nav__link">
1170 <li class=
"md-nav__item">
1171 <a href=
"../../package/pip/object-type/" class=
"md-nav__link">
1182 <li class=
"md-nav__item">
1183 <a href=
"../../package/pip/object-type-definition/" class=
"md-nav__link">
1184 objectTypeDefinition
1194 <li class=
"md-nav__item">
1195 <a href=
"../../package/pip/option/" class=
"md-nav__link">
1206 <li class=
"md-nav__item">
1207 <a href=
"../../package/pip/page/" class=
"md-nav__link">
1218 <li class=
"md-nav__item">
1219 <a href=
"../../package/pip/pip/" class=
"md-nav__link">
1230 <li class=
"md-nav__item">
1231 <a href=
"../../package/pip/script/" class=
"md-nav__link">
1242 <li class=
"md-nav__item">
1243 <a href=
"../../package/pip/smiley/" class=
"md-nav__link">
1254 <li class=
"md-nav__item">
1255 <a href=
"../../package/pip/sql/" class=
"md-nav__link">
1266 <li class=
"md-nav__item">
1267 <a href=
"../../package/pip/style/" class=
"md-nav__link">
1278 <li class=
"md-nav__item">
1279 <a href=
"../../package/pip/template/" class=
"md-nav__link">
1290 <li class=
"md-nav__item">
1291 <a href=
"../../package/pip/template-listener/" class=
"md-nav__link">
1302 <li class=
"md-nav__item">
1303 <a href=
"../../package/pip/user-group-option/" class=
"md-nav__link">
1314 <li class=
"md-nav__item">
1315 <a href=
"../../package/pip/user-menu/" class=
"md-nav__link">
1326 <li class=
"md-nav__item">
1327 <a href=
"../../package/pip/user-notification-event/" class=
"md-nav__link">
1328 userNotificationEvent
1338 <li class=
"md-nav__item">
1339 <a href=
"../../package/pip/user-option/" class=
"md-nav__link">
1350 <li class=
"md-nav__item">
1351 <a href=
"../../package/pip/user-profile-menu/" class=
"md-nav__link">
1368 <li class=
"md-nav__item">
1369 <a href=
"../../package/database-php-api/" class=
"md-nav__link">
1390 <li class=
"md-nav__item md-nav__item--nested">
1393 <input class=
"md-nav__toggle md-toggle" data-md-toggle=
"__nav_6" type=
"checkbox" id=
"__nav_6" >
1395 <label class=
"md-nav__link" for=
"__nav_6">
1397 <span class=
"md-nav__icon md-icon"></span>
1399 <nav class=
"md-nav" aria-label=
"Migration" data-md-level=
"1">
1400 <label class=
"md-nav__title" for=
"__nav_6">
1401 <span class=
"md-nav__icon md-icon"></span>
1404 <ul class=
"md-nav__list" data-md-scrollfix
>
1411 <li class=
"md-nav__item md-nav__item--nested">
1414 <input class=
"md-nav__toggle md-toggle" data-md-toggle=
"__nav_6_1" type=
"checkbox" id=
"__nav_6_1" >
1416 <label class=
"md-nav__link" for=
"__nav_6_1">
1417 Migrating from WSC
5.3
1418 <span class=
"md-nav__icon md-icon"></span>
1420 <nav class=
"md-nav" aria-label=
"Migrating from WSC 5.3" data-md-level=
"2">
1421 <label class=
"md-nav__title" for=
"__nav_6_1">
1422 <span class=
"md-nav__icon md-icon"></span>
1423 Migrating from WSC
5.3
1425 <ul class=
"md-nav__list" data-md-scrollfix
>
1431 <li class=
"md-nav__item">
1432 <a href=
"../../migration/wsc53/php/" class=
"md-nav__link">
1443 <li class=
"md-nav__item">
1444 <a href=
"../../migration/wsc53/session/" class=
"md-nav__link">
1445 Session Handling and Authentication
1455 <li class=
"md-nav__item">
1456 <a href=
"../../migration/wsc53/javascript/" class=
"md-nav__link">
1467 <li class=
"md-nav__item">
1468 <a href=
"../../migration/wsc53/templates/" class=
"md-nav__link">
1479 <li class=
"md-nav__item">
1480 <a href=
"../../migration/wsc53/libraries/" class=
"md-nav__link">
1481 Third Party Libraries
1498 <li class=
"md-nav__item md-nav__item--nested">
1501 <input class=
"md-nav__toggle md-toggle" data-md-toggle=
"__nav_6_2" type=
"checkbox" id=
"__nav_6_2" >
1503 <label class=
"md-nav__link" for=
"__nav_6_2">
1504 Migrating from WSC
5.2
1505 <span class=
"md-nav__icon md-icon"></span>
1507 <nav class=
"md-nav" aria-label=
"Migrating from WSC 5.2" data-md-level=
"2">
1508 <label class=
"md-nav__title" for=
"__nav_6_2">
1509 <span class=
"md-nav__icon md-icon"></span>
1510 Migrating from WSC
5.2
1512 <ul class=
"md-nav__list" data-md-scrollfix
>
1518 <li class=
"md-nav__item">
1519 <a href=
"../../migration/wsc52/php/" class=
"md-nav__link">
1530 <li class=
"md-nav__item">
1531 <a href=
"../../migration/wsc52/templates/" class=
"md-nav__link">
1532 Templates and Languages
1542 <li class=
"md-nav__item">
1543 <a href=
"../../migration/wsc52/libraries/" class=
"md-nav__link">
1544 Third Party Libraries
1561 <li class=
"md-nav__item md-nav__item--nested">
1564 <input class=
"md-nav__toggle md-toggle" data-md-toggle=
"__nav_6_3" type=
"checkbox" id=
"__nav_6_3" >
1566 <label class=
"md-nav__link" for=
"__nav_6_3">
1567 Migrating from WSC
3.1
1568 <span class=
"md-nav__icon md-icon"></span>
1570 <nav class=
"md-nav" aria-label=
"Migrating from WSC 3.1" data-md-level=
"2">
1571 <label class=
"md-nav__title" for=
"__nav_6_3">
1572 <span class=
"md-nav__icon md-icon"></span>
1573 Migrating from WSC
3.1
1575 <ul class=
"md-nav__list" data-md-scrollfix
>
1581 <li class=
"md-nav__item">
1582 <a href=
"../../migration/wsc31/php/" class=
"md-nav__link">
1600 <li class=
"md-nav__item md-nav__item--nested">
1603 <input class=
"md-nav__toggle md-toggle" data-md-toggle=
"__nav_6_4" type=
"checkbox" id=
"__nav_6_4" >
1605 <label class=
"md-nav__link" for=
"__nav_6_4">
1606 Migrating from WSC
3.0
1607 <span class=
"md-nav__icon md-icon"></span>
1609 <nav class=
"md-nav" aria-label=
"Migrating from WSC 3.0" data-md-level=
"2">
1610 <label class=
"md-nav__title" for=
"__nav_6_4">
1611 <span class=
"md-nav__icon md-icon"></span>
1612 Migrating from WSC
3.0
1614 <ul class=
"md-nav__list" data-md-scrollfix
>
1620 <li class=
"md-nav__item">
1621 <a href=
"../../migration/wsc30/php/" class=
"md-nav__link">
1632 <li class=
"md-nav__item">
1633 <a href=
"../../migration/wsc30/javascript/" class=
"md-nav__link">
1644 <li class=
"md-nav__item">
1645 <a href=
"../../migration/wsc30/templates/" class=
"md-nav__link">
1656 <li class=
"md-nav__item">
1657 <a href=
"../../migration/wsc30/css/" class=
"md-nav__link">
1668 <li class=
"md-nav__item">
1669 <a href=
"../../migration/wsc30/package/" class=
"md-nav__link">
1687 <li class=
"md-nav__item md-nav__item--nested">
1690 <input class=
"md-nav__toggle md-toggle" data-md-toggle=
"__nav_6_5" type=
"checkbox" id=
"__nav_6_5" >
1692 <label class=
"md-nav__link" for=
"__nav_6_5">
1693 Migrating from WCF
2.1
1694 <span class=
"md-nav__icon md-icon"></span>
1696 <nav class=
"md-nav" aria-label=
"Migrating from WCF 2.1" data-md-level=
"2">
1697 <label class=
"md-nav__title" for=
"__nav_6_5">
1698 <span class=
"md-nav__icon md-icon"></span>
1699 Migrating from WCF
2.1
1701 <ul class=
"md-nav__list" data-md-scrollfix
>
1707 <li class=
"md-nav__item">
1708 <a href=
"../../migration/wcf21/php/" class=
"md-nav__link">
1719 <li class=
"md-nav__item">
1720 <a href=
"../../migration/wcf21/templates/" class=
"md-nav__link">
1731 <li class=
"md-nav__item">
1732 <a href=
"../../migration/wcf21/css/" class=
"md-nav__link">
1743 <li class=
"md-nav__item">
1744 <a href=
"../../migration/wcf21/package/" class=
"md-nav__link">
1771 <li class=
"md-nav__item md-nav__item--nested">
1774 <input class=
"md-nav__toggle md-toggle" data-md-toggle=
"__nav_7" type=
"checkbox" id=
"__nav_7" >
1776 <label class=
"md-nav__link" for=
"__nav_7">
1778 <span class=
"md-nav__icon md-icon"></span>
1780 <nav class=
"md-nav" aria-label=
"Tutorials" data-md-level=
"1">
1781 <label class=
"md-nav__title" for=
"__nav_7">
1782 <span class=
"md-nav__icon md-icon"></span>
1785 <ul class=
"md-nav__list" data-md-scrollfix
>
1792 <li class=
"md-nav__item md-nav__item--nested">
1795 <input class=
"md-nav__toggle md-toggle" data-md-toggle=
"__nav_7_1" type=
"checkbox" id=
"__nav_7_1" >
1797 <label class=
"md-nav__link" for=
"__nav_7_1">
1799 <span class=
"md-nav__icon md-icon"></span>
1801 <nav class=
"md-nav" aria-label=
"Tutorial Series" data-md-level=
"2">
1802 <label class=
"md-nav__title" for=
"__nav_7_1">
1803 <span class=
"md-nav__icon md-icon"></span>
1806 <ul class=
"md-nav__list" data-md-scrollfix
>
1812 <li class=
"md-nav__item">
1813 <a href=
"../../tutorial/series/overview/" class=
"md-nav__link">
1824 <li class=
"md-nav__item">
1825 <a href=
"../../tutorial/series/part_1/" class=
"md-nav__link">
1836 <li class=
"md-nav__item">
1837 <a href=
"../../tutorial/series/part_2/" class=
"md-nav__link">
1848 <li class=
"md-nav__item">
1849 <a href=
"../../tutorial/series/part_3/" class=
"md-nav__link">
1876 <div class=
"md-sidebar md-sidebar--secondary" data-md-component=
"sidebar" data-md-type=
"toc" >
1877 <div class=
"md-sidebar__scrollwrap">
1878 <div class=
"md-sidebar__inner">
1880 <nav class=
"md-nav md-nav--secondary" aria-label=
"Table of contents">
1886 <label class=
"md-nav__title" for=
"__toc">
1887 <span class=
"md-nav__icon md-icon"></span>
1890 <ul class=
"md-nav__list" data-md-component=
"toc" data-md-scrollfix
>
1892 <li class=
"md-nav__item">
1893 <a href=
"#helper-functions" class=
"md-nav__link">
1899 <li class=
"md-nav__item">
1900 <a href=
"#domutil" class=
"md-nav__link">
1904 <nav class=
"md-nav" aria-label=
"Dom/Util">
1905 <ul class=
"md-nav__list">
1907 <li class=
"md-nav__item">
1908 <a href=
"#createfragmentfromhtmlhtml-string-documentfragment" class=
"md-nav__link">
1909 createFragmentFromHtml(html: string): DocumentFragment
1914 <li class=
"md-nav__item">
1915 <a href=
"#identifyelement-element-string" class=
"md-nav__link">
1916 identify(element: Element): string
1921 <li class=
"md-nav__item">
1922 <a href=
"#outerheightelement-element-styles-cssstyledeclaration-number" class=
"md-nav__link">
1923 outerHeight(element: Element, styles?: CSSStyleDeclaration): number
1928 <li class=
"md-nav__item">
1929 <a href=
"#outerwidthelement-element-styles-cssstyledeclaration-number" class=
"md-nav__link">
1930 outerWidth(element: Element, styles?: CSSStyleDeclaration): number
1935 <li class=
"md-nav__item">
1936 <a href=
"#outerdimensionselement-element-height-number-width-number" class=
"md-nav__link">
1937 outerDimensions(element: Element): { height: number, width: number }
1942 <li class=
"md-nav__item">
1943 <a href=
"#offsetelement-element-top-number-left-number" class=
"md-nav__link">
1944 offset(element: Element): { top: number, left: number }
1949 <li class=
"md-nav__item">
1950 <a href=
"#setinnerhtmlelement-element-innerhtml-string" class=
"md-nav__link">
1951 setInnerHtml(element: Element, innerHtml: string)
1956 <li class=
"md-nav__item">
1957 <a href=
"#containselement-element-child-element-boolean" class=
"md-nav__link">
1958 contains(element: Element, child: Element): boolean
1963 <li class=
"md-nav__item">
1964 <a href=
"#unwrapchildnodeselement-element" class=
"md-nav__link">
1965 unwrapChildNodes(element: Element)
1975 <li class=
"md-nav__item">
1976 <a href=
"#domchangelistener" class=
"md-nav__link">
1990 <div class=
"md-content" data-md-component=
"content">
1991 <article class=
"md-content__inner md-typeset">
1995 <h1 id=
"working-with-the-dom-javascript-api">Working with the DOM - JavaScript API
<a class=
"headerlink" href=
"#working-with-the-dom-javascript-api" title=
"Permanent link">#
</a></h1>
1996 <h2 id=
"helper-functions">Helper Functions
<a class=
"headerlink" href=
"#helper-functions" title=
"Permanent link">#
</a></h2>
1997 <p>There is large set of
<a href=
"../helper-functions/">helper functions
</a> that assist
1998 you when working with the DOM tree and its elements. These functions are globally
1999 available and do not require explicit module imports.
</p>
2000 <h2 id=
"domutil"><code>Dom/Util
</code><a class=
"headerlink" href=
"#domutil" title=
"Permanent link">#
</a></h2>
2001 <h3 id=
"createfragmentfromhtmlhtml-string-documentfragment"><code>createFragmentFromHtml(html: string): DocumentFragment
</code><a class=
"headerlink" href=
"#createfragmentfromhtmlhtml-string-documentfragment" title=
"Permanent link">#
</a></h3>
2002 <p>Parses a HTML string and creates a
<code>DocumentFragment
</code> object that holds the
2003 resulting nodes.
</p>
2004 <h3 id=
"identifyelement-element-string"><code>identify(element: Element): string
</code><a class=
"headerlink" href=
"#identifyelement-element-string" title=
"Permanent link">#
</a></h3>
2005 <p>Retrieves the unique identifier (
<code>id
</code>) of an element. If it does not currently
2006 have an id assigned, a generic identifier is used instead.
</p>
2007 <h3 id=
"outerheightelement-element-styles-cssstyledeclaration-number"><code>outerHeight(element: Element, styles?: CSSStyleDeclaration): number
</code><a class=
"headerlink" href=
"#outerheightelement-element-styles-cssstyledeclaration-number" title=
"Permanent link">#
</a></h3>
2008 <p>Computes the outer height of an element using the element's
<code>offsetHeight
</code> and
2009 the sum of the rounded down values for
<code>margin-top
</code> and
<code>margin-bottom
</code>.
</p>
2010 <h3 id=
"outerwidthelement-element-styles-cssstyledeclaration-number"><code>outerWidth(element: Element, styles?: CSSStyleDeclaration): number
</code><a class=
"headerlink" href=
"#outerwidthelement-element-styles-cssstyledeclaration-number" title=
"Permanent link">#
</a></h3>
2011 <p>Computes the outer width of an element using the element's
<code>offsetWidth
</code> and
2012 the sum of the rounded down values for
<code>margin-left
</code> and
<code>margin-right
</code>.
</p>
2013 <h3 id=
"outerdimensionselement-element-height-number-width-number"><code>outerDimensions(element: Element): { height: number, width: number }
</code><a class=
"headerlink" href=
"#outerdimensionselement-element-height-number-width-number" title=
"Permanent link">#
</a></h3>
2014 <p>Computes the outer dimensions of an element including its margins.
</p>
2015 <h3 id=
"offsetelement-element-top-number-left-number"><code>offset(element: Element): { top: number, left: number }
</code><a class=
"headerlink" href=
"#offsetelement-element-top-number-left-number" title=
"Permanent link">#
</a></h3>
2016 <p>Computes the element's offset relative to the top left corner of the document.
</p>
2017 <h3 id=
"setinnerhtmlelement-element-innerhtml-string"><code>setInnerHtml(element: Element, innerHtml: string)
</code><a class=
"headerlink" href=
"#setinnerhtmlelement-element-innerhtml-string" title=
"Permanent link">#
</a></h3>
2018 <p>Sets the inner HTML of an element via
<code>element.innerHTML = innerHtml
</code>. Browsers
2019 do not evaluate any embedded
<code><script
></code> tags, therefore this method extracts each
2020 of them, creates new
<code><script
></code> tags and inserts them in their original order of
2022 <h3 id=
"containselement-element-child-element-boolean"><code>contains(element: Element, child: Element): boolean
</code><a class=
"headerlink" href=
"#containselement-element-child-element-boolean" title=
"Permanent link">#
</a></h3>
2023 <p>Evaluates if
<code>element
</code> is a direct or indirect parent element of
<code>child
</code>.
</p>
2024 <h3 id=
"unwrapchildnodeselement-element"><code>unwrapChildNodes(element: Element)
</code><a class=
"headerlink" href=
"#unwrapchildnodeselement-element" title=
"Permanent link">#
</a></h3>
2025 <p>Moves all child nodes out of
<code>element
</code> while maintaining their order, then removes
2026 <code>element
</code> from the document.
</p>
2027 <h2 id=
"domchangelistener"><code>Dom/ChangeListener
</code><a class=
"headerlink" href=
"#domchangelistener" title=
"Permanent link">#
</a></h2>
2028 <p>This class is used to observe specific changes to the DOM, for example after an
2029 Ajax request has completed. For performance reasons this is a manually-invoked
2030 listener that does not rely on a
<code>MutationObserver
</code>.
</p>
2031 <div class=
"highlight"><pre><span></span><code><span class=
"nx">require
</span><span class=
"p">([
</span><span class=
"s2">"Dom/ChangeListener
"</span><span class=
"p">],
</span> <span class=
"kd">function
</span><span class=
"p">(
</span><span class=
"nx">DomChangeListener
</span><span class=
"p">)
</span> <span class=
"p">{
</span>
2032 <span class=
"nx">DomChangeListener
</span><span class=
"p">.
</span><span class=
"nx">add
</span><span class=
"p">(
</span><span class=
"s2">"App/Foo
"</span><span class=
"p">,
</span> <span class=
"kd">function
</span><span class=
"p">()
</span> <span class=
"p">{
</span>
2033 <span class=
"c1">// the DOM may have been altered significantly
</span>
2034 <span class=
"p">});
</span>
2036 <span class=
"c1">// propagate changes to the DOM
</span>
2037 <span class=
"nx">DomChangeListener
</span><span class=
"p">.
</span><span class=
"nx">trigger
</span><span class=
"p">();
</span>
2038 <span class=
"p">});
</span>
2053 <footer class=
"md-footer">
2055 <nav class=
"md-footer__inner md-grid" aria-label=
"Footer">
2057 <a href=
"../new-api_core/" class=
"md-footer__link md-footer__link--prev" rel=
"prev">
2058 <div class=
"md-footer__button md-icon">
2059 <svg xmlns=
"http://www.w3.org/2000/svg" viewBox=
"0 0 24 24"><path d=
"M20 11v2H8l5.5 5.5-1.42 1.42L4.16 12l7.92-7.92L13.5 5.5 8 11h12z"/></svg>
2061 <div class=
"md-footer__title">
2062 <div class=
"md-ellipsis">
2063 <span class=
"md-footer__direction">
2072 <a href=
"../new-api_events/" class=
"md-footer__link md-footer__link--next" rel=
"next">
2073 <div class=
"md-footer__title">
2074 <div class=
"md-ellipsis">
2075 <span class=
"md-footer__direction">
2081 <div class=
"md-footer__button md-icon">
2082 <svg xmlns=
"http://www.w3.org/2000/svg" viewBox=
"0 0 24 24"><path d=
"M4 11v2h12l-5.5 5.5 1.42 1.42L19.84 12l-7.92-7.92L10.5 5.5 16 11H4z"/></svg>
2088 <div class=
"md-footer-meta md-typeset">
2089 <div class=
"md-footer-meta__inner md-grid">
2090 <div class=
"md-footer-copyright">
2092 <div class=
"md-footer-copyright__highlight">
2093 Copyright ©
2020 WoltLab GmbH
2097 <a href=
"https://squidfunk.github.io/mkdocs-material/" target=
"_blank" rel=
"noopener">
2101 <div class=
"md-footer-copyright">
2102 <a href=
"https://www.woltlab.com/legal-notice/">Legal Notice
</a>
2103 <a href=
"https://www.woltlab.com/privacy-policy/">Privacy Policy
</a>
2110 <div class=
"md-dialog" data-md-component=
"dialog">
2111 <div class=
"md-dialog__inner md-typeset"></div>
2113 <script id=
"__config" type=
"application/json">{
"base":
"../..",
"features": [],
"translations": {
"clipboard.copy":
"Copy to clipboard",
"clipboard.copied":
"Copied to clipboard",
"search.config.lang":
"en",
"search.config.pipeline":
"trimmer, stopWordFilter",
"search.config.separator":
"[\\s\\-]+",
"search.placeholder":
"Search",
"search.result.placeholder":
"Type to start searching",
"search.result.none":
"No matching documents",
"search.result.one":
"1 matching document",
"search.result.other":
"# matching documents",
"search.result.more.one":
"1 more on this page",
"search.result.more.other":
"# more on this page",
"search.result.term.missing":
"Missing"},
"search":
"../../assets/javascripts/workers/search.fb4a9340.min.js",
"version": {
"provider":
"mike"}}
</script>
2116 <script src=
"../../assets/javascripts/bundle.ca5457b8.min.js"></script>