Add element table attributes
421779
protected function addElementTableAttributes()
    {
        $segments = Craft::$app->getRequest()->getSegments();
        $actionSegment = $segments[count($segments) - 1] ?? null;

        $classes = [Entry::class, Category::class];

        foreach ($classes as $class) {

            // Register "Add child" attribute
            Event::on($class, Element::EVENT_REGISTER_TABLE_ATTRIBUTES, function (RegisterElementTableAttributesEvent $event) use ($actionSegment) {
                $event->tableAttributes['_childme_addChild'] = $actionSegment !== 'get-elements' ? Craft::t('child-me', 'Add child') : '';
            });

            // Get the HTML for that attribute
            Event::on($class, Element::EVENT_SET_TABLE_ATTRIBUTE_HTML, function (SetElementTableAttributeHtmlEvent $event) use ($class) {
                if ($event->attribute === '_childme_addChild') {

                    $html = '';

                    switch ($class) {
                        case 'craft\elements\Entry':

                            $entry = $event->sender;

                            if ($entry->section->type !== 'structure') {
                                break;
                            }

                            $maxLevels = $entry->section->maxLevels;
                            $visible = !$maxLevels || $entry->level < $maxLevels;

                            $newUrl = UrlHelper::cpUrl(implode('/', ['entries', $entry->section->handle, 'new']), [
                                'typeId' => $entry->type->id,
                                'parentId' => $entry->id,
                            ]);

                            $html = $this->getElementTableAttributeHtml($newUrl, $visible, [
                                'data-section="' . $entry->section->handle . '"',
                                'data-id="' . $entry->id . '"'
                            ]);

                            break;
                        case 'craft\elements\Category':

                            $category = $event->sender;
                            $maxLevels = $category->group->maxLevels;
                            $visible = !$maxLevels || $category->level < $maxLevels;

                            $newUrl = UrlHelper::cpUrl(implode('/', ['categories', $category->group->handle, 'new']), [
                                'parentId' => $category->id,
                            ]);

                            $html = $this->getElementTableAttributeHtml($newUrl, $visible);

                            break;
                    }

                    $event->html = $html;
                    $event->handled = true;

                }


            });
        }


    }
707817
function(item, tableRow) {
				tableRow.className += "treeTableRow addsitesTableRow"; //$NON-NLS-0$
				
				var siteConfigCol = document.createElement("td"); //$NON-NLS-0$
				siteConfigCol.id = tableRow.id + "col1"; //$NON-NLS-0$
				var actionCol = document.createElement("td"); //$NON-NLS-0$
				actionCol.id = tableRow.id + "col4"; //$NON-NLS-0$
				
				// Site config column
				var href = mSiteUtils.generateEditSiteHref(item);
				var nameLink = document.createElement("a"); //$NON-NLS-0$
				nameLink.href = href;
				siteConfigCol.appendChild(nameLink);
				nameLink.textContent = item.Name;
				
				var statusField = document.createElement("span"); //$NON-NLS-0$
				statusField.style.padding = "0 10px 0 10px"; //$NON-NLS-0$
				siteConfigCol.appendChild(statusField);
				
				// Status, URL columns
				var status = item.HostingStatus;
				if (typeof status === "object") { //$NON-NLS-0$
					if (status.Status === "started") { //$NON-NLS-0$
						statusField.appendChild(document.createTextNode(messages["Started"]));
						var link = document.createElement("a"); //$NON-NLS-0$
						link.href = status.URL;
						link.textContent = status.URL;
						siteConfigCol.appendChild(link);
					} else {
						var statusString = status.Status.substring(0,1).toUpperCase() + status.Status.substring(1);
						statusField.appendChild(document.createTextNode(statusString));
					}
				} else {
					statusField.appendChild(document.createTextNode(messages["Unknown"]));
				}
				
				// Action column
				var actionsWrapper = document.createElement("span"); //$NON-NLS-0$
				actionsWrapper.id = tableRow.id + "actionswrapper"; //$NON-NLS-0$
				actionsWrapper.classList.add("sectionTableItemActions"); //$NON-NLS-0$
				actionCol.appendChild(actionsWrapper);
				var options = this._options;
				var userData = {
					startCallback: options.startCallback,
					stopCallback: options.stopCallback,
					deleteCallback: options.deleteCallback,
					errorCallback: function(err) {
						options.serviceRegistry.getService('orion.page.message').setProgressResult(err); //$NON-NLS-0$
					}
				};
				this._commandService.renderCommands(options.actionScopeId, actionsWrapper, item, null /*handler*/, "tool", userData); //$NON-NLS-0$

				tableRow.appendChild(siteConfigCol);
				tableRow.appendChild(actionCol);
			}
1092470
function setElAttributes(el, attributes) {
  Object.getOwnPropertyNames(attributes).forEach(function (attrName) {
    var attrValue = attributes[attrName];

    if (attrValue === null || typeof attrValue === 'undefined' || attrValue === false) {
      el.removeAttribute(attrName);
    } else {
      el.setAttribute(attrName, attrValue === true ? '' : attrValue);
    }
  });
}
428940
def add(ns, element_name, value, attributes={})
      element = REXML::Element.new(element_name)
      if ns.is_a?(Namespace)
        unless ns.prefix.nil? || ns.prefix.empty?
          element.name = "#{ns.prefix}:#{element_name}"
          element.add_namespace ns.prefix, ns.uri unless @ns == ns || @ns == ns.uri
        else
          element.add_namespace ns.uri unless @ns == ns || @ns == ns.uri
        end
      else
        element.add_namespace ns unless @ns == ns || @ns.to_s == ns
      end
      if value.is_a?(Element)
        value.elem.each_element do |e|
          element.add e.deep_clone
        end
        value.elem.attributes.each_attribute do |a|
          unless a.name =~ /^xmlns(?:\:)?/
            element.add_attribute a
          end
        end
        #element.text = value.elem.text unless value.elem.text.nil?
        text = value.elem.get_text
        unless text.nil?
          element.text = REXML::Text.new(text.to_s, true, nil, true)
        end
      else
        if value.is_a?(REXML::Element)
          element.add_element value.deep_clone
        else
          element.add_text value.to_s
        end
      end
      element.add_attributes attributes unless attributes.nil?
      @elem.add_element element
    end
559066
function(el, oAttr) {  
            YUD.addClass(el, this.CLASSES.ACCORDION);
            this._setARIA(el, 'role', 'tree');
            var aCollectedItems = [];
            var aListItems = el.getElementsByTagName(this.CONFIG.ITEM_WRAPPER_TAG_NAME);

            for(var i=0;i<aListItems.length;i++) {           
                if(YUD.hasClass(aListItems[i], 'nopanel')) {         
                    aCollectedItems.push({label: 'SINGLE_LINK', content: aListItems[i].innerHTML.replace(/^\s\s*/, '').replace(/\s\s*$/, '')});
                }
                else {
                    if(aListItems[i].parentNode === el) {
                        for (var eHeader = aListItems[i].firstChild; eHeader && eHeader.nodeType != 1; eHeader = eHeader.nextSibling) {
                        // This loop looks for the first non-textNode element
                        }
                        if (eHeader) {
                            for (var eContent = eHeader.nextSibling; eContent && eContent .nodeType != 1; eContent = eContent .nextSibling) {
                            // here we go for the second non-textNode element, if there was a first one
                            }
                        aCollectedItems.push({label: eHeader.innerHTML, content: (eContent && eContent.innerHTML)});
                        }
                    }
                }
            }
            el.innerHTML = '';
            if(aCollectedItems.length > 0) {
                this.addPanels(aCollectedItems);
            }
            
            if((oAttr.expandItem === 0) || (oAttr.expandItem > 0)) {                                   
                var eLink = this._panels[oAttr.expandItem].firstChild;
                var eContent = this._panels[oAttr.expandItem].firstChild.nextSibling;
                YUD.removeClass(eContent, this.CLASSES.HIDDEN);
                if(eLink && eContent) {
                    YUD.addClass(eLink, this.CLASSES.ACTIVE);
                    eLink.tabIndex = 0;
                    this._setARIA(eLink, 'aria-expanded', 'true');
                    this._setARIA(eContent, 'aria-hidden', 'false');
                }
            }
   
            this.initEvents();
        }
362686
function() {
      if (!this.el) {
        var attrs = _.extend({}, _.result(this, 'attributes'));
        if (this.id) attrs.id = _.result(this, 'id');
        if (this.className) attrs['class'] = _.result(this, 'className');
        this.setElement(this._createElement(_.result(this, 'tagName')));
        this._setAttributes(attrs);
      } else {
        this.setElement(_.result(this, 'el'));
      }
    }
1043509
def _set_element_property(parent_to_parse, element_path, prop_name, value):
    

    element = get_element(parent_to_parse)

    if element is None:
        return None

    if element_path and not element_exists(element, element_path):
        element = insert_element(element, 0, element_path)

    if not isinstance(value, string_types):
        value = u''

    setattr(element, prop_name, value)

    return element
352895
function updateAttributes( element ) {
		var attrs = element.attributes,
			styles;

		// Will be recreated later if any of styles/classes exists.
		delete attrs.style;
		delete attrs[ 'class' ];

		if ( ( styles = CKEDITOR.tools.writeCssText( element.styles, true ) ) )
			attrs.style = styles;

		if ( element.classes.length )
			attrs[ 'class' ] = element.classes.sort().join( ' ' );
	}
904898
function attributes(el, attrs, store) {
  for(var key in attrs) {
    var value = attrs[key];
    if(typeof value === 'object') value = styles(value);
    else if(typeof value === 'function') {
      var bool = key.substring(0, 2) === 'on';
      if(bool) el.addEventListener(key.slice(2), value);
      else el.setAttribute(key, value.call(store.data));
      // @not we should compute the function if it's not an event
      break;
    }

    bind(value, function(data) {
       // @note should refactor with render (too bad attribute can't append text node anymore)
       el.setAttribute(this, data);
    }.bind(key), store);
  }
}
440415
function buildAddonTable(addons, enabledAddons) {
  var tbody = document.querySelector('.addonPicker tbody');

  // Remove all old content.
  while (tbody.firstChild) {
    tbody.firstChild.remove();
  }

  // Add empty row.
  if (!addons.length) {
    var tr = document.createElement('tr');
    tr.className = 'emptyRow';
    var td = document.createElement('td');
    td.innerText = 'No addons added.';
    tr.appendChild(td);
    tbody.appendChild(tr);
  }

  // Build the table.
  for (var n = 0; n < addons.length; n++) {
    var extension = addons[n];
    addExtensionRow(extension);
  }
  function addExtensionRow(extension) {
    var isEnabled = enabledAddons.indexOf(extension.url) >= 0;;

    var td = document.createElement('td');
    var input = document.createElement('input');
    input.type = 'checkbox';
    input.checked = isEnabled;
    td.appendChild(input);
    var span = document.createElement('span');
    span.innerText = extension.manifest.name;
    span.title = extension.url;
    td.appendChild(span);

    var remove = document.createElement('td');
    remove.className = 'remove';
    var removeImg = document.createElement('img');
    removeImg.title = 'Remove extension';
    remove.appendChild(removeImg);

    var tr = document.createElement('tr');
    tr.appendChild(td);
    tr.appendChild(remove);

    tbody.appendChild(tr);

    function changed() {
      _gaq.push(['_trackEvent', 'popup', 'addon_toggled']);

      port.postMessage({
        command: 'toggle_extension',
        enabled: input.checked,
        url: extension.url
      });
    };
    input.onchange = function() {
      changed();
    };
    span.onclick = function() {
      input.checked = !input.checked;
      changed();
    };

    remove.onclick = function() {
      _gaq.push(['_trackEvent', 'popup', 'addon_removed']);

      if (isEnabled) {
        port.postMessage({
          command: 'toggle_addon',
          enabled: false,
          url: extension.url
        });
      }
      port.postMessage({
        command: 'remove_addon',
        url: extension.url
      });
    };
  };
}
569425
protected void registerTableAttributes() {
        addAttributeProcessor(new OneColumnLmlAttribute(), "oneColumn");
        addAttributeProcessor(new TableAlignLmlAttribute(), "tableAlign");
        addAttributeProcessor(new TableBackgroundLmlAttribute(), "bg", "background");
        addAttributeProcessor(new TablePadBottomLmlAttribute(), "tablePadBottom");
        addAttributeProcessor(new TablePadLeftLmlAttribute(), "tablePadLeft");
        addAttributeProcessor(new TablePadLmlAttribute(), "tablePad");
        addAttributeProcessor(new TablePadRightLmlAttribute(), "tablePadRight");
        addAttributeProcessor(new TablePadTopLmlAttribute(), "tablePadTop");
        addAttributeProcessor(new TableRoundLmlAttribute(), "round");
        registerCellAttributes();
    }
769198
function showAttrs(node) {
        var i;
        var out = "<table class='ms-vb' width='100%'>";
        for (i = 0; i < node.attributes.length; i++) {
            out += "<tr><td width='10px' style='font-weight:bold;'>" + i + "</td><td width='100px'>" +
            node.attributes.item(i).nodeName + "</td><td>" + checkLink(node.attributes.item(i).nodeValue) + "</td></tr>";
        }
        out += "</table>";
        return out;
    }
756700
def _add_attr_property(self):
        
        property_ = property(self._getter, self._setter, None)
        # assign unconditionally to overwrite element name definition
        setattr(self._element_cls, self._prop_name, property_)
250342
function(el) {
      (el.length > 0) && (el = el[0]);
      var orgAttributes = {};
      for (var i=0; i<el.attributes.length; i++) {
        var attr = el.attributes[i];
        orgAttributes[attr.name] = attr.value;
      }
      return orgAttributes;
    }
1233422
def _cell_attribute_append(self, selection, tab, attributes):
        """"""

        cell_attributes = self.code_array.cell_attributes

        thick_bottom_cells = []
        thick_right_cells = []

        # Does any cell in selection.cells have a larger bottom border?

        if "borderwidth_bottom" in attributes:
            bwidth = attributes["borderwidth_bottom"]
            for row, col in selection.cells:
                __bwidth = cell_attributes[row, col, tab]["borderwidth_bottom"]
                if __bwidth > bwidth:
                    thick_bottom_cells.append((row, col))

        # Does any cell in selection.cells have a larger right border?
        if "borderwidth_right" in attributes:
            rwidth = attributes["borderwidth_right"]
            for row, col in selection.cells:
                __rwidth = cell_attributes[row, col, tab]["borderwidth_right"]
                if __rwidth > rwidth:
                    thick_right_cells.append((row, col))

        for thick_cell in thick_bottom_cells + thick_right_cells:
            try:
                selection.cells.remove(thick_cell)
            except ValueError:
                pass

        cell_attributes.append((selection, tab, attributes))

        if thick_bottom_cells:
            bsel = copy(selection)
            bsel.cells = thick_bottom_cells
            battrs = copy(attributes)
            battrs.pop("borderwidth_bottom")
            cell_attributes.append((bsel, tab, battrs))

        if thick_right_cells:
            rsel = copy(selection)
            rsel.cells = thick_right_cells
            rattrs = copy(attributes)
            rattrs.pop("borderwidth_right")
            cell_attributes.append((rsel, tab, rattrs))
203606
function _setAttributes(el, attrs) {
  Object.keys(attrs).forEach((key) => {
    el.setAttribute(key, attrs[key]);
  });
}
13003
protected void addAttributes(SXTag tag, Collection<XAttribute> attributes)
			throws IOException {
		for (XAttribute attribute : attributes) {
			SXTag attributeTag;
			if (attribute instanceof XAttributeList) {
				attributeTag = tag.addChildNode("list");
				attributeTag.addAttribute("key", attribute.getKey());
			} else if (attribute instanceof XAttributeContainer) {
				attributeTag = tag.addChildNode("container");
				attributeTag.addAttribute("key", attribute.getKey());
			} else if (attribute instanceof XAttributeLiteral) {
				attributeTag = tag.addChildNode("string");
				attributeTag.addAttribute("key", attribute.getKey());
				attributeTag.addAttribute("value", attribute.toString());
			} else if (attribute instanceof XAttributeDiscrete) {
				attributeTag = tag.addChildNode("int");
				attributeTag.addAttribute("key", attribute.getKey());
				attributeTag.addAttribute("value", attribute.toString());
			} else if (attribute instanceof XAttributeContinuous) {
				attributeTag = tag.addChildNode("float");
				attributeTag.addAttribute("key", attribute.getKey());
				attributeTag.addAttribute("value", attribute.toString());
			} else if (attribute instanceof XAttributeTimestamp) {
				attributeTag = tag.addChildNode("date");
				attributeTag.addAttribute("key", attribute.getKey());
				Date timestamp = ((XAttributeTimestamp) attribute).getValue();
				attributeTag.addAttribute("value",
						xsDateTimeConversion.format(timestamp));
			} else if (attribute instanceof XAttributeBoolean) {
				attributeTag = tag.addChildNode("boolean");
				attributeTag.addAttribute("key", attribute.getKey());
				attributeTag.addAttribute("value", attribute.toString());
			} else if (attribute instanceof XAttributeID) {
				attributeTag = tag.addChildNode("id");
				attributeTag.addAttribute("key", attribute.getKey());
				attributeTag.addAttribute("value", attribute.toString());
			} else {
				throw new IOException("Unknown attribute type!");
			}
			if (attribute instanceof XAttributeCollection) {
				/*
				 * Use order as specified by the collection.
				 */
				Collection<XAttribute> childAttributes = ((XAttributeCollection) attribute).getCollection();
				addAttributes(attributeTag, childAttributes);
			} else {
				addAttributes(attributeTag, attribute.getAttributes().values());
			}
		}
	}