Skip to content
This repository has been archived by the owner on Apr 17, 2019. It is now read-only.

Commit

Permalink
Let setAttributes chain and use HTML for Template projects
Browse files Browse the repository at this point in the history
  • Loading branch information
Zibi Braniecki committed May 24, 2016
1 parent c794525 commit 6a90432
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
13 changes: 13 additions & 0 deletions .tern-project
@@ -0,0 +1,13 @@
{
"ecmaVersion": 6,
"libs": [
"browser",
"ecma6"
],
"plugins": {
"node": {},
"complete_strings": {},
"modules": {},
"es_modules": {}
}
}
1 change: 1 addition & 0 deletions src/bindings/dom.js
Expand Up @@ -13,6 +13,7 @@ export function setAttributes(element, id, args) {
if (args) {
element.setAttribute('data-l10n-args', JSON.stringify(args));
}
return element;
}

export function getAttributes(element) {
Expand Down
6 changes: 4 additions & 2 deletions src/bindings/overlay.js
Expand Up @@ -12,6 +12,7 @@ const allowed = {
global: ['title', 'aria-label', 'aria-valuetext', 'aria-moz-hint'],
a: ['download'],
area: ['download', 'alt'],
button: ['accesskey'], // used by XUL
// value is special-cased in isAttrAllowed
input: ['alt', 'placeholder'],
menuitem: ['label'],
Expand All @@ -34,7 +35,8 @@ export function overlayElement(element, translation) {
} else {
// start with an inert template element and move its children into
// `element` but such that `element`'s own children are not replaced
const tmpl = element.ownerDocument.createElement('template');
const tmpl = element.ownerDocument.createElementNS(
'http://www.w3.org/1999/xhtml', 'template');
tmpl.innerHTML = value;
// overlay the node with the DocumentFragment
overlay(element, tmpl.content);
Expand Down Expand Up @@ -155,7 +157,7 @@ function getNthElementOfType(context, element, index) {
let nthOfType = 0;
for (let i = 0, child; child = context.children[i]; i++) {
if (child.nodeType === child.ELEMENT_NODE &&
child.tagName === element.tagName) {
child.tagName.toLowerCase() === element.tagName.toLowerCase()) {
if (nthOfType === index) {
return child;
}
Expand Down

0 comments on commit 6a90432

Please sign in to comment.