Use 'elData()' instead of 'elAttr()' wherever possible
authorFabii <fabiangossner@gmail.com>
Fri, 22 Jan 2016 17:52:07 +0000 (18:52 +0100)
committerFabii <fabiangossner@gmail.com>
Fri, 22 Jan 2016 17:52:07 +0000 (18:52 +0100)
18 files changed:
wcfsetup/install/files/js/WoltLab/WCF/Attachment/Upload.js
wcfsetup/install/files/js/WoltLab/WCF/Bbcode/Collapsible.js
wcfsetup/install/files/js/WoltLab/WCF/Bbcode/FromHtml.js
wcfsetup/install/files/js/WoltLab/WCF/Controller/Clipboard.js
wcfsetup/install/files/js/WoltLab/WCF/Controller/Notice/Dismiss.js
wcfsetup/install/files/js/WoltLab/WCF/Controller/Popover.js
wcfsetup/install/files/js/WoltLab/WCF/Controller/User/Notification/Settings.js
wcfsetup/install/files/js/WoltLab/WCF/Date/Picker.js
wcfsetup/install/files/js/WoltLab/WCF/Date/Time/Relative.js
wcfsetup/install/files/js/WoltLab/WCF/Language/Input.js
wcfsetup/install/files/js/WoltLab/WCF/Ui/Collapsible/Sidebar.js
wcfsetup/install/files/js/WoltLab/WCF/Ui/Dialog.js
wcfsetup/install/files/js/WoltLab/WCF/Ui/ItemList.js
wcfsetup/install/files/js/WoltLab/WCF/Ui/Like/Handler.js
wcfsetup/install/files/js/WoltLab/WCF/Ui/Page/JumpTo.js
wcfsetup/install/files/js/WoltLab/WCF/Ui/Suggestion.js
wcfsetup/install/files/js/WoltLab/WCF/Ui/TabMenu/Simple.js
wcfsetup/install/files/js/WoltLab/WCF/Ui/Tooltip.js

index 403545884cd4e9984f23bcc6e65178641191cfb0..33c2ab5892e1808bab76faa7d5b9c7e5ea9e5984 100644 (file)
@@ -54,7 +54,7 @@ define(['Core', 'Dom/ChangeListener', 'Dom/Traverse', 'Language', 'List', 'Uploa
                _createFileElement: function(file) {
                        var listItem = elCreate('li');
                        listItem.className = 'box64';
-                       elAttr(listItem, 'data-filename', filename);
+                       elData(listItem, 'filename', filename);
                        this._target.appendChild(listItem);
                        this._target.style.removeProperty('display');
                        
@@ -131,8 +131,8 @@ define(['Core', 'Dom/ChangeListener', 'Dom/Traverse', 'Language', 'List', 'Uploa
                                var progress = elByTag(listItem, 'PROGRESS');
                                progress.parentNode.removeChild(progress);
                                
-                               var filename = elAttr(listItem, 'data-filename');
-                               var internalFileId = elAttr(listItem, 'data-internal-file-id');
+                               var filename = elData(listItem, 'filename');
+                               var internalFileId = elData(listItem, 'internal-file-id');
                                
                                var icon = DomTraverse.childByClass(listItem, 'fa-spinner');
                                
@@ -144,9 +144,9 @@ define(['Core', 'Dom/ChangeListener', 'Dom/Traverse', 'Language', 'List', 'Uploa
                                                elAttr(img, 'src', attachment.tinyURL);
                                                elAttr(img, 'alt', '');
                                                icon.parentNode.replaceChild(icon, img);
-                                               
-                                               elAttr(listItem, 'data-height', attachment.height);
-                                               elAttr(listItem, 'data-width', attachment.width);
+
+                                               elData(listItem, 'height', attachment.height);
+                                               elData(listItem, 'width', attachment.width);
                                        }
                                        else {
                                                // TODO: Use FileUtil.getIconClassByMimeType()?
@@ -179,14 +179,14 @@ define(['Core', 'Dom/ChangeListener', 'Dom/Traverse', 'Language', 'List', 'Uploa
                                        var span = elCreate('span');
                                        span.className = 'button small jsDeleteButton';
                                        span.textContent = Language.get('wcf.global.button.delete');
-                                       elAttr(span, 'data-object-id', attachment.attachmentID);
-                                       elAttr(span, 'data-confirm-message', Language.get('wcf.attachment.delete.sure'));
+                                       elData(span, 'object-id', attachment.attachmentID);
+                                       elData(span, 'confirm-message', Language.get('wcf.attachment.delete.sure'));
                                        if (this._wysiwygContainerId) {
-                                               elAttr(span, 'data-event-name', 'attachment_' + this._wysiwygContainerId);
+                                               elData(span, 'event-name', 'attachment_' + this._wysiwygContainerId);
                                        }
                                        deleteButton.appendChild(span);
                                        
-                                       elAttr(span, 'data-object-id', attachment.attachmentID);
+                                       elData(span, 'object-id', attachment.attachmentID);
                                        
                                        if (this._wysiwygContainerId) {
                                                if (attachment.tinyURL) {
@@ -196,7 +196,7 @@ define(['Core', 'Dom/ChangeListener', 'Dom/Traverse', 'Language', 'List', 'Uploa
                                                        span = elCreate('span');
                                                        span.className = 'button small jsButtonAttachmentInsertThumbnail';
                                                        span.textContent = Language.get('wcf.global.button.insertThumbnail');
-                                                       elAttr(span, 'data-object-id', attachment.attachmentID);
+                                                       elData(span, 'object-id', attachment.attachmentID);
                                                        span.addEventListener('click', this._insert.bind(this));
                                                        insertThumbnailButton.appendChild(span);
                                                        
@@ -206,18 +206,18 @@ define(['Core', 'Dom/ChangeListener', 'Dom/Traverse', 'Language', 'List', 'Uploa
                                                        span = elCreate('span');
                                                        span.className = 'button small jsButtonAttachmentInsertFull';
                                                        span.textContent = Language.get('wcf.global.button.insertFull');
-                                                       elAttr(span, 'data-object-id', attachment.attachmentID);
+                                                       elData(span, 'object-id', attachment.attachmentID);
                                                        span.addEventListener('click', this._insert.bind(this));
                                                        insertOriginalButton.appendChild(span);
                                                }
                                                else {
-                                                       var insertPlainButton elCreate('li');
+                                                       var insertPlainButton elCreate('li');
                                                        ul.appendChild(insertPlainButton);
                                                        
                                                        span = elCreate('span');
                                                        span.className = 'button small jsButtonAttachmentInsertPlain';
                                                        span.textContent = Language.get('wcf.global.button.insert');
-                                                       elAttr(span, 'data-object-id', attachment.attachmentID);
+                                                       elData(span, 'object-id', attachment.attachmentID);
                                                        span.addEventListener('click', this._insert.bind(this));
                                                        insertPlainButton.appendChild(span);
                                                }
index bb44fb95ba802b5af7c61b249d20e40099329b58..ccfed639fee7fc7431118ba2df74adb161a4e88f 100644 (file)
@@ -30,7 +30,7 @@ define([], function() {
                                        var toggle = function() {
                                                var expand = container.classList.contains('collapsed');
                                                container.classList[expand ? 'remove' : 'add']('collapsed');
-                                               toggleButton.textContent = elAttr(toggleButton, 'data-title-' + (expand ? 'collapse' : 'expand'));
+                                               toggleButton.textContent = elData(toggleButton, 'title-' + (expand ? 'collapse' : 'expand'));
                                        };
                                        
                                        toggleButton.addEventListener('click', toggle);
index 97c302a2e456773f41464a7d94d2d43bd45c1621..bc162b4eaef42b1a9b2ae5e86a6d8f8eac0c3886 100644 (file)
@@ -106,7 +106,7 @@ define(['EventHandler', 'StringUtil', 'Dom/Traverse'], function(EventHandler, St
                 */
                _preserveSourceElement: function(element, sourceElements) {
                        var placeholder = elCreate('var');
-                       elAttr(placeholder, 'data-source', 'wcf');
+                       elData(placeholder, 'source', 'wcf');
                        element.parentNode.insertBefore(placeholder, element);
                        
                        var fragment = document.createDocumentFragment();
@@ -245,7 +245,7 @@ define(['EventHandler', 'StringUtil', 'Dom/Traverse'], function(EventHandler, St
                 * @param       {Element}       element         target element
                 */
                _convertBlockquote: function(element) {
-                       var author = elAttr(element, 'data-author');
+                       var author = elData(element, 'author');
                        var link = elAttr(element, 'cite');
                        
                        var open = '[quote]';
@@ -287,7 +287,7 @@ define(['EventHandler', 'StringUtil', 'Dom/Traverse'], function(EventHandler, St
                        width = (typeof width === 'string') ? ~~width.replace(/px$/, '') : 0;
                        
                        if (element.classList.contains('redactorEmbeddedAttachment')) {
-                               var attachmentId = elAttr(element, 'data-attachment-id');
+                               var attachmentId = elData(element, 'attachment-id');
                                
                                if (width > 0) {
                                        element.outerHTML = "[attach=" + attachmentId + "," + float + "," + width + "][/attach]";
@@ -525,8 +525,8 @@ define(['EventHandler', 'StringUtil', 'Dom/Traverse'], function(EventHandler, St
                 * @param       {Element}       element         target element
                 */
                _convertSourceCodeBox: function(element) {
-                       var filename = elAttr(element, 'data-filename').trim() || '';
-                       var highlighter = elAttr(element, 'data-highlighter');
+                       var filename = elData(element, 'filename').trim() || '';
+                       var highlighter = elData(element, 'highlighter');
                        window.dtdesign = element;
                        var list = DomTraverse.childByTag(element.children[0], 'OL');
                        var lineNumber = ~~list.getAttribute('start') || 1;
index 300932e56fa4ecf1b006a689e71d5b2894daa5c2..0c3a3b8dc76d92e67dc2a20b5ae6da244d324c7f 100644 (file)
@@ -88,7 +88,7 @@ define(
                                if (containerData === undefined) {
                                        var markAll = elBySel('.jsClipboardMarkAll', container);
                                        if (markAll !== null) {
-                                               elAttr(markAll, 'data-container-id', containerId);
+                                               elData(markAll, 'container-id', containerId);
                                                markAll.addEventListener('click', this._markAll.bind(this));
                                        }
                                        
@@ -105,7 +105,7 @@ define(
                                        var checkbox = containerData.checkboxes[j];
                                        
                                        if (!_knownCheckboxes.has(checkbox)) {
-                                               elAttr(checkbox, 'data-container-id', containerId);
+                                               elData(checkbox, 'container-id', containerId);
                                                checkbox.addEventListener('click', _callbackCheckbox);
                                                
                                                _knownCheckboxes.add(checkbox);
@@ -120,7 +120,7 @@ define(
                _initEditors: function() {
                        var getTypes = function(editor) {
                                try {
-                                       var types = elAttr(editor, 'data-types');
+                                       var types = elData(editor, 'types');
                                        if (typeof types === 'string') {
                                                return JSON.parse('{ "types": ' + types.replace(/'/g, '"') + '}').types;
                                        }
@@ -166,7 +166,7 @@ define(
                        var isMarked = (checkbox.nodeName !== 'INPUT' || checkbox.checked);
                        var objectIds = [];
                        
-                       var containerId = elAttr(checkbox, 'data-container-id');
+                       var containerId = elData(checkbox, 'container-id');
                        var data = _containers.get(containerId);
                        var type = elAttr(data.element, 'data-type');
                        
@@ -209,7 +209,7 @@ define(
                        var checkbox = event.currentTarget;
                        var objectId = ~~checkbox.getAttribute('data-object-id');
                        var isMarked = checkbox.checked;
-                       var containerId = elAttr(checkbox, 'data-container-id');
+                       var containerId = elData(checkbox, 'container-id');
                        var data = _containers.get(containerId);
                        var type = elAttr(data.element, 'data-type');
                        
@@ -267,7 +267,7 @@ define(
                        }
                        
                        var triggerEvent = function() {
-                               var type = elAttr(listItem, 'data-type');
+                               var type = elData(listItem, 'type');
                                
                                EventHandler.fire('com.woltlab.wcf.clipboard', type, {
                                        data: data,
@@ -369,7 +369,7 @@ define(
                                parameters: parameters
                        }, (function(responseData) {
                                if (data.actionName !== 'unmarkAll') {
-                                       var type = elAttr(listItem, 'data-type');
+                                       var type = elData(listItem, 'type');
                                        
                                        EventHandler.fire('com.woltlab.wcf.clipboard', type, {
                                                data: data,
@@ -501,8 +501,8 @@ define(
                                        label.textContent = itemData.label;
                                        item.appendChild(label);
                                        itemList.appendChild(item);
-                                       
-                                       elAttr(item, 'data-type', typeName);
+
+                                       elData(item, 'type', typeName);
                                        item.addEventListener('click', _callbackItem);
                                        
                                        _itemData.set(item, itemData);
@@ -514,7 +514,7 @@ define(
                                
                                // add 'unmark all'
                                var unmarkAll = elCreate('li');
-                               elAttr(unmarkAll, 'data-type', typeName);
+                               elData(unmarkAll, 'type', typeName);
                                var label = elCreate('span');
                                label.textContent = Language.get('wcf.clipboard.item.unmarkAll');
                                unmarkAll.appendChild(label);
index ec19886ee3065b3cbdfd05d26ab3d8b03b3e6b73..8a08603be75a54cb8ecacef23ebcf08887eca2e5 100644 (file)
@@ -37,7 +37,7 @@ define(['Ajax'], function(Ajax) {
                                data: {
                                        actionName: 'dismiss',
                                        className: 'wcf\\data\\notice\\NoticeAction',
-                                       objectIDs: [ elAttr(button, 'data-object-id') ]
+                                       objectIDs: [ elData(button, 'object-id') ]
                                },
                                success: function() {
                                        var parent = button.parentNode;
index f8a220ae25857b232309e9a29fec7800b363b6a6..06ab96ff0d335806c64e185359b4ce12af19e302 100644 (file)
@@ -180,7 +180,7 @@ define(['Ajax', 'Dictionary', 'Environment', 'Dom/ChangeListener', 'Dom/Util', '
                                }
                                
                                var cacheId = identifier + "-" + objectId;
-                               elAttr(element, 'data-cache-id', cacheId);
+                               elData(element, 'cache-id', cacheId);
                                
                                _elements.set(id, {
                                        element: element,
@@ -217,7 +217,7 @@ define(['Ajax', 'Dictionary', 'Environment', 'Dom/ChangeListener', 'Dom/Util', '
                        if (_activeId) {
                                var activeElement = _elements.get(_activeId).element;
                                
-                               if (elAttr(activeElement, 'data-cache-id') === cacheId) {
+                               if (elData(activeElement, 'cache-id') === cacheId) {
                                        this._show();
                                }
                        }
index 44b6a34853c018cf721dda4f5ac442130a1b1896..9d39431d3158871d93701417636040a5d16f2400 100644 (file)
@@ -55,7 +55,7 @@ define(['Dictionary', 'Language', 'Dom/Traverse', 'Ui/SimpleDropdown'], function
                        var mailValue = DomTraverse.childByTag(mailSetting, 'INPUT');
                        
                        var button = DomTraverse.childByTag(mailSetting, 'A');
-                       elAttr(button, 'data-object-id', groupId);
+                       elData(button, 'object-id', groupId);
                        button.addEventListener('click', _callbackClick);
                        
                        _data.set(groupId, {
@@ -103,7 +103,7 @@ define(['Dictionary', 'Language', 'Dom/Traverse', 'Ui/SimpleDropdown'], function
                _createDropdown: function(objectId, initialValue) {
                        var dropdownMenu = elCreate('ul');
                        dropdownMenu.className = 'dropdownMenu';
-                       elAttr(dropdownMenu, 'data-object-id', objectId);
+                       elData(dropdownMenu, 'object-id', objectId);
                        
                        var link, listItem, value, items = ['instant', 'daily', 'divider', 'none'];
                        for (var i = 0; i < 4; i++) {
@@ -117,7 +117,7 @@ define(['Dictionary', 'Language', 'Dom/Traverse', 'Ui/SimpleDropdown'], function
                                        link = elCreate('a');
                                        link.textContent = Language.get('wcf.user.notification.mailNotificationType.' + value);
                                        listItem.appendChild(link);
-                                       elAttr(listItem, 'data-value', value);
+                                       elData(listItem, 'value', value);
                                        listItem.addEventListener('click', _callbackSelectType);
                                        
                                        if (initialValue === value) {
index 60989b967520a5cbfac5cd7187350883d0116d74..976ba33f7634fec1c08e8273fd564be1f10a0f15 100644 (file)
@@ -48,14 +48,14 @@ define(['DateUtil', 'Language', 'ObjectMap', 'Dom/ChangeListener', 'Ui/Alignment
                                element.readOnly = true;
                                
                                var isDateTime = (elAttr(element, 'type') === 'datetime');
-                               
-                               elAttr(element, 'data-is-date-time', isDateTime);
+
+                               elData(element, 'is-date-time', isDateTime);
                                
                                // convert value
                                var date = null, value = elAttr(element, 'value');
                                if (elAttr(element, 'value')) {
                                        date = new Date(value);
-                                       elAttr(element, 'data-value', date.getTime());
+                                       elData(element, 'value', date.getTime());
                                        value = DateUtil['formatDate' + (isDateTime ? 'Time' : '')](date);
                                }
                                
@@ -63,24 +63,24 @@ define(['DateUtil', 'Language', 'ObjectMap', 'Dom/ChangeListener', 'Ui/Alignment
                                
                                // handle birthday input
                                if (element.classList.contains('birthday')) {
-                                       elAttr(element, 'data-min-date', '100');
-                                       elAttr(element, 'data-max-date', 'now');
+                                       elData(element, 'min-date', '100');
+                                       elData(element, 'max-date', 'now');
                                }
                                
                                this._initDateRange(element, now, true);
                                this._initDateRange(element, now, false);
                                
-                               if (elAttr(element, 'data-min-date') === elAttr(element, 'data-max-date')) {
+                               if (elData(element, 'min-date') === elData(element, 'max-date')) {
                                        throw new Error("Minimum and maximum date cannot be the same (element id '" + element.id + "').");
                                }
                                
                                // change type to prevent browser's datepicker to trigger
                                element.type = 'text';
                                element.value = value;
-                               elAttr(element, 'data-empty', isEmpty);
+                               elData(element, 'empty', isEmpty);
                                
-                               if (elAttr(element, 'data-placeholder')) {
-                                       elAttr(element, 'placeholder', elAttr(element, 'data-placeholder'));
+                               if (elData(element, 'placeholder')) {
+                                       elAttr(element, 'placeholder', elData(element, 'placeholder'));
                                }
                                
                                // add a hidden element to hold the actual date
@@ -652,8 +652,8 @@ define(['DateUtil', 'Language', 'ObjectMap', 'Dom/ChangeListener', 'Ui/Alignment
                setDate: function(element, date) {
                        element = this._getElement(element);
                        var data = _data.get(element);
-                       
-                       elAttr(element, 'data-value', date.getTime());
+
+                       elData(element, 'value', date.getTime());
                        element.value = DateUtil['formatDate' + (data.isDateTime ? 'Time' : '')](date);
                        
                        data.shadow.value = DateUtil.format(date, (data.isDateTime ? 'c' : 'Y-m-d'));
index 6e4c36a47f7c99d7ee79b92946eaf92ef5eb0321..58a4b0a507fb00eac0cb2162d19a84c4b4824133 100644 (file)
@@ -35,14 +35,14 @@ define(['Dom/ChangeListener', 'Language', 'WoltLab/WCF/Date/Util', 'WoltLab/WCF/
                        for (var i = 0, length = _elements.length; i < length; i++) {
                                var element = _elements[i];
                                
-                               if (!element.classList.contains('datetime') || elAttr(element, 'data-is-future-date')) continue;
+                               if (!element.classList.contains('datetime') || elData(element, 'is-future-date')) continue;
                                
                                if (!element.getAttribute('title')) elAttr(element, 'title', element.textContent.trim());
                                
                                var elTimestamp = ~~element.getAttribute('data-timestamp') + _offset;
-                               var elDate = elAttr(element, 'data-date');
-                               var elTime = elAttr(element, 'data-time');
-                               var elOffset = elAttr(element, 'data-offset');
+                               var elDate = elData(element, 'date');
+                               var elTime = elData(element, 'time');
+                               var elOffset = elData(element, 'offset');
                                
                                // timestamp is less than 60 seconds ago
                                if (elTimestamp >= timestamp || timestamp < (elTimestamp + 60)) {
index c7a8798c42f032a272cd3daa0effda6603dda13f..6c01ad896e7c173d4e4db0a3ac1a2065031298bb 100644 (file)
@@ -79,7 +79,7 @@ define(['Core', 'Dictionary', 'Language', 'ObjectMap', 'StringUtil', 'Dom/Traver
                        if (!container.classList.contains('inputAddon')) {
                                container = elCreate('div');
                                container.className = 'inputAddon' + (element.nodeName === 'TEXTAREA' ? ' inputAddonTextarea' : '');
-                               elAttr(container, 'data-input-id', elementId);
+                               elData(container, 'input-id', elementId);
                                
                                element.parentNode.insertBefore(container, element);
                                container.appendChild(element);
@@ -114,7 +114,7 @@ define(['Core', 'Dictionary', 'Language', 'ObjectMap', 'StringUtil', 'Dom/Traver
                        for (var languageId in availableLanguages) {
                                if (availableLanguages.hasOwnProperty(languageId)) {
                                        var listItem = elCreate('li');
-                                       elAttr(listItem, 'data-language-id', languageId);
+                                       elData(listItem, 'language-id', languageId);
                                        
                                        span = elCreate('span');
                                        span.textContent = availableLanguages[languageId];
@@ -131,7 +131,7 @@ define(['Core', 'Dictionary', 'Language', 'ObjectMap', 'StringUtil', 'Dom/Traver
                                dropdownMenu.appendChild(listItem);
                                
                                listItem = elCreate('li');
-                               elAttr(listItem, 'data-language-id', 0);
+                               elData(listItem, 'language-id', 0);
                                span = elCreate('span');
                                span.textContent = Language.get('wcf.global.button.disabledI18n');
                                listItem.appendChild(span);
@@ -194,7 +194,7 @@ define(['Core', 'Dictionary', 'Language', 'ObjectMap', 'StringUtil', 'Dom/Traver
                        for (var i = 0, length = dropdownMenu.childElementCount; i < length; i++) {
                                item = dropdownMenu.children[i];
                                
-                               var itemLanguageId = elAttr(item, 'data-language-id');
+                               var itemLanguageId = elData(item, 'language-id');
                                if (itemLanguageId.length && languageId === ~~itemLanguageId) {
                                        label = item.children[0].textContent;
                                }
index bbb67995accd463da709485cb3daef297b564f29..9729bd899943d8ba486021fd62f672803f41435d 100644 (file)
@@ -26,9 +26,9 @@ define(['Ajax', 'Language', 'Dom/Util'], function(Ajax, Language, DomUtil) {
                                return;
                        }
                        
-                       _isOpen = (elAttr(sidebar, 'data-is-open') === 'true');
+                       _isOpen = (elData(sidebar, 'is-open') === 'true');
                        _main = elById('main');
-                       _name = elAttr(sidebar, 'data-sidebar-name');
+                       _name = elData(sidebar, 'sidebar-name');
                        
                        this._createUI(sidebar);
                        
index 6916667bcfe8af324584cc19b0cf4ded129d7b71..966e02b86c5a3fcb3b5db095aa2ea75eeaebc52f 100644 (file)
@@ -75,12 +75,12 @@ define(
                                button = _staticDialogs[0];
                                button.classList.remove('jsStaticDialog');
                                
-                               id = elAttr(button, 'data-dialog-id');
+                               id = elData(button, 'dialog-id');
                                if (id && (container = elById(id))) {
                                        ((function(button, container) {
                                                container.classList.remove('jsStaticDialogContent');
                                                container.style.setProperty('display', 'none');
-                                               button.addEventListener('click', this.openStatic.bind(this, container.id, null, { title: elAttr(container, 'data-title') }));
+                                               button.addEventListener('click', this.openStatic.bind(this, container.id, null, { title: elData(container, 'title') }));
                                        }).bind(this))(button, container);
                                }
                        }
@@ -258,10 +258,10 @@ define(
                        dialog.classList.add('dialogContainer');
                        elAttr(dialog, 'aria-hidden', 'true');
                        elAttr(dialog, 'role', 'dialog');
-                       elAttr(dialog, 'data-id', id);
+                       elData(dialog, 'id', id);
                        
                        if (options.disposeOnClose) {
-                               elAttr(dialog, 'data-dispose-on-close', true);
+                               elData(dialog, 'dispose-on-close', true);
                        }
                        
                        var header = elCreate('header');
@@ -517,7 +517,7 @@ define(
                        for (var i = 0; i < _container.childElementCount; i++) {
                                var child = _container.children[i];
                                if (elAttr(child, 'aria-hidden') === 'false') {
-                                       _activeDialog = elAttr(child, 'data-id');
+                                       _activeDialog = elData(child, 'id');
                                        break;
                                }
                        }
index f2d8a1f0eba142c96cc275a677b063bb7de93657..0ad283ba101b25024ee6ae7a660758b6768d574f 100644 (file)
@@ -143,7 +143,7 @@ define(['Core', 'Dictionary', 'Language', 'Dom/Traverse', 'WoltLab/WCF/Ui/Sugges
                        for (var i = 0, length = items.length; i < length; i++) {
                                item = items[i];
                                value = {
-                                       objectId: elAttr(item, 'data-object-id'),
+                                       objectId: elData(item, 'object-id'),
                                        value: DomTraverse.childByTag(item, 'SPAN').textContent
                                };
                                
@@ -179,7 +179,7 @@ define(['Core', 'Dictionary', 'Language', 'Dom/Traverse', 'WoltLab/WCF/Ui/Sugges
                _createUI: function(element, options) {
                        var list = elCreate('ol');
                        list.className = 'inputItemList';
-                       elAttr(list, 'data-element-id', element.id);
+                       elData(list, 'element-id', element.id);
                        list.addEventListener('click', function(event) {
                                if (event.target === list) element.focus();
                        });
@@ -342,7 +342,7 @@ define(['Core', 'Dictionary', 'Language', 'Dom/Traverse', 'WoltLab/WCF/Ui/Sugges
                        
                        var content = elCreate('span');
                        content.className = 'content';
-                       elAttr(content, 'data-object-id', value.objectId);
+                       elData(content, 'object-id', value.objectId);
                        content.textContent = value.value;
                        
                        var button = elCreate('a');
@@ -374,7 +374,7 @@ define(['Core', 'Dictionary', 'Language', 'Dom/Traverse', 'WoltLab/WCF/Ui/Sugges
                        item = (event === null) ? item : event.currentTarget.parentNode;
                        
                        var parent = item.parentNode;
-                       var elementId = elAttr(parent, 'data-element-id');
+                       var elementId = elData(parent, 'element-id');
                        var data = _data.get(elementId);
                        
                        data.suggestion.removeExcludedValue(item.children[0].textContent);
index 311ba61a77a51cf83e6345dfdb320f182b3064f7..cae130f0b7ef88ab1d3e784296e332cd31824979 100644 (file)
@@ -77,11 +77,11 @@ define(
                                        likeButton: null,
                                        summary: null,
                                        
-                                       dislikes: ~~elAttr(element, 'data-like-dislikes'),
-                                       liked: ~~elAttr(element, 'data-like-liked'),
-                                       likes: ~~elAttr(element, 'data-like-likes'),
-                                       objectId: ~~elAttr(element, 'data-object-id'),
-                                       users: JSON.parse(elAttr(element, 'data-like-users'))
+                                       dislikes: ~~elData(element, 'like-dislikes'),
+                                       liked: ~~elData(element, 'like-liked'),
+                                       likes: ~~elData(element, 'like-likes'),
+                                       objectId: ~~elData(element, 'object-id'),
+                                       users: JSON.parse(elData(element, 'like-users'))
                                };
                                
                                this._containers.set(element, elementData);
@@ -134,7 +134,7 @@ define(
                                this._updateBadge(element);
                        }
                        
-                       var insertPosition, userId = elAttr(element, 'data-user-id');
+                       var insertPosition, userId = elData(element, 'user-id');
                        if (this._options.canLikeOwnContent || WCF.User.userID === userId) {
                                insertPosition = elBySel(this._options.buttonBeforeSelector, element);
                                if (insertPosition !== null) {
index 3e1c6d5a64feb4797980b6191e85b48b449390f8..f922e4214bff8181d7fb15a62221c22341ab2d1b 100644 (file)
@@ -28,7 +28,7 @@ define(['Language', 'ObjectMap', 'Ui/Dialog'], function(Language, ObjectMap, UiD
                init: function(element, callback) {
                        callback = callback || null;
                        if (callback === null) {
-                               var redirectUrl = elAttr(element, 'data-link');
+                               var redirectUrl = elData(element, 'link');
                                if (redirectUrl) {
                                        callback = function(pageNo) {
                                                window.location = redirectUrl.replace(/pageNo=%d/, 'pageNo=' + pageNo);
@@ -68,7 +68,7 @@ define(['Language', 'ObjectMap', 'Ui/Dialog'], function(Language, ObjectMap, UiD
                        
                        UiDialog.open(this);
                        
-                       var pages = elAttr(element, 'data-pages');
+                       var pages = elData(element, 'pages');
                        _input.value = pages;
                        _input.setAttribute('max', pages);
                        
index fa72f04c6f7daa51eea67a0d6c7208106367e745..65094dee94d96d7815d9208e2570b7e5947d5f47 100644 (file)
@@ -223,7 +223,7 @@ define(['Ajax', 'Core', 'Ui/SimpleDropdown'], function(Ajax, Core, UiSimpleDropd
                                        
                                        anchor = elCreate('a');
                                        anchor.textContent = item.label;
-                                       elAttr(anchor, 'data-object-id', item.objectID);
+                                       elData(anchor, 'object-id', item.objectID);
                                        anchor.addEventListener('click', this._select.bind(this));
                                        
                                        listItem = elCreate('li');
index c06d17cb2de49cc3c885e18d9e2d9f3c45085a63..4e1d322fe2d58f1e0bb853c81909493d422fd9b2 100644 (file)
@@ -56,13 +56,13 @@ define(['Dictionary', 'Dom/Traverse', 'Dom/Util', 'EventHandler'], function(Dict
                        var container, containers = DomTraverse.childrenByTag(this._container, 'DIV'), name;
                        for (var i = 0, length = containers.length; i < length; i++) {
                                container = containers[i];
-                               name = elAttr(container, 'data-name');
+                               name = elData(container, 'name');
                                
                                if (!name) {
                                        name = DomUtil.identify(container);
                                }
-                               
-                               elAttr(container, 'data-name', name);
+
+                               elData(container, 'name', name);
                                this._containers.set(name, container);
                        }
                        
@@ -124,7 +124,7 @@ define(['Dictionary', 'Dom/Traverse', 'Dom/Util', 'EventHandler'], function(Dict
                        
                        // bind listeners
                        this._tabs.forEach((function(tab) {
-                               if (!oldTabs || oldTabs.get(elAttr(tab, 'data-name')) !== tab) {
+                               if (!oldTabs || oldTabs.get(elData(tab, 'name')) !== tab) {
                                        tab.children[0].addEventListener('click', this._onClick.bind(this));
                                }
                        }).bind(this));
@@ -199,19 +199,19 @@ define(['Dictionary', 'Dom/Traverse', 'Dom/Util', 'EventHandler'], function(Dict
                                }
                        }
                        
-                       name = name || elAttr(tab, 'data-name');
+                       name = name || elData(tab, 'name');
                        
                        // unmark active tab
                        var oldTab = elBySel('#' + this._container.id + ' > nav > ul > li.active');
                        var oldContent = null;
                        if (oldTab) {
-                               if (elAttr(oldTab, 'data-name') === name) {
+                               if (elData(oldTab, 'name') === name) {
                                        // same tab
                                        return;
                                }
                                
                                oldTab.classList.remove('active');
-                               oldContent = this._containers.get(elAttr(oldTab, 'data-name'));
+                               oldContent = this._containers.get(elData(oldTab, 'name'));
                                oldContent.classList.remove('active');
                                oldContent.classList.add('hidden');
                                
@@ -257,7 +257,7 @@ define(['Dictionary', 'Dom/Traverse', 'Dom/Util', 'EventHandler'], function(Dict
                                        active: tab,
                                        activeName: name,
                                        previous: oldTab,
-                                       previousName: oldTab ? elAttr(oldTab, 'data-name') : null
+                                       previousName: oldTab ? elData(oldTab, 'name') : null
                                });
                                
                                var jQuery = (this._isLegacy && typeof window.jQuery === 'function') ? window.jQuery : null;
@@ -312,7 +312,7 @@ define(['Dictionary', 'Dom/Traverse', 'Dom/Util', 'EventHandler'], function(Dict
                 * @return      {string}        tab name
                 */
                _getTabName: function(tab) {
-                       var name = elAttr(tab, 'data-name');
+                       var name = elData(tab, 'name');
                        
                        // handle legacy tab menus
                        if (!name) {
@@ -325,7 +325,7 @@ define(['Dictionary', 'Dom/Traverse', 'Dom/Util', 'EventHandler'], function(Dict
                                                }
                                                else {
                                                        this._isLegacy = true;
-                                                       elAttr(tab, 'data-name', name);
+                                                       elData(tab, 'name', name);
                                                }
                                        }
                                }
index 172f95bf47ac1845e163cff847449644f3a45e53..cf4d87a3f89763aee5205f969e6ba77be1db7cfb 100644 (file)
@@ -58,7 +58,7 @@ define(['Environment', 'Dom/ChangeListener', 'Ui/Alignment'], function(Environme
                                title = (typeof title === 'string') ? title.trim() : '';
                                
                                if (title.length) {
-                                       elAttr(element, 'data-tooltip', title);
+                                       elData(element, 'tooltip', title);
                                        element.removeAttribute('title');
                                        
                                        element.addEventListener('mouseenter', this._mouseEnter.bind(this));
@@ -79,11 +79,11 @@ define(['Environment', 'Dom/ChangeListener', 'Ui/Alignment'], function(Environme
                        title = (typeof title === 'string') ? title.trim() : '';
                        
                        if (title !== '') {
-                               elAttr(element, 'data-tooltip', title);
+                               elData(element, 'tooltip', title);
                                element.removeAttribute('title');
                        }
                        
-                       title = elAttr(element, 'data-tooltip');
+                       title = elData(element, 'tooltip');
                        
                        // reset tooltip position
                        _tooltip.style.removeProperty('top');