merge m-c to fx-team

This commit is contained in:
Tim Taubert 2013-05-23 20:55:32 +02:00
commit 1d26f8d70f
3 changed files with 15 additions and 23 deletions

View File

@ -4,16 +4,11 @@
var kMaxChunkDuration = 30; // ms
var escape = document.createElement('textarea');
function escapeHTML(html) {
escape.innerHTML = html;
return escape.innerHTML;
}
function unescapeHTML(html) {
escape.innerHTML = html;
return escape.value;
var pre = document.createElementNS("http://www.w3.org/1999/xhtml", "pre");
var text = document.createTextNode(html);
pre.appendChild(text);
return pre.innerHTML;
}
RegExp.escape = function(text) {

View File

@ -10,8 +10,7 @@ this.EXPORTED_SYMBOLS = ["SplitView"];
/* this must be kept in sync with CSS (ie. splitview.css) */
const LANDSCAPE_MEDIA_QUERY = "(min-width: 551px)";
const BINDING_USERDATA = "splitview-binding";
let bindings = new WeakMap();
/**
* SplitView constructor
@ -115,7 +114,7 @@ SplitView.prototype = {
}
if (this._activeSummary) {
let binding = this._activeSummary.getUserData(BINDING_USERDATA);
let binding = bindings.get(this._activeSummary);
if (binding.onHide) {
binding.onHide(this._activeSummary, binding._details, binding.data);
@ -129,7 +128,7 @@ SplitView.prototype = {
return;
}
let binding = aSummary.getUserData(BINDING_USERDATA);
let binding = bindings.get(aSummary);
aSummary.classList.add("splitview-active");
binding._details.classList.add("splitview-active");
@ -147,7 +146,7 @@ SplitView.prototype = {
get activeDetails()
{
let summary = this.activeSummary;
return summary ? summary.getUserData(BINDING_USERDATA)._details : null;
return summary ? bindings.get(summary)._details : null;
},
/**
@ -193,7 +192,7 @@ SplitView.prototype = {
binding._summary = aSummary;
binding._details = aDetails;
aSummary.setUserData(BINDING_USERDATA, binding, null);
bindings.set(aSummary, binding);
this._nav.appendChild(aSummary);
@ -258,7 +257,7 @@ SplitView.prototype = {
this.activeSummary = null;
}
let binding = aSummary.getUserData(BINDING_USERDATA);
let binding = bindings.get(aSummary);
aSummary.parentNode.removeChild(aSummary);
binding._details.parentNode.removeChild(binding._details);
@ -289,7 +288,7 @@ SplitView.prototype = {
*/
setItemClassName: function ASV_setItemClassName(aSummary, aClassName)
{
let binding = aSummary.getUserData(BINDING_USERDATA);
let binding = bindings.get(aSummary);
let viewSpecific;
viewSpecific = aSummary.className.match(/(splitview\-[\w-]+)/g);

View File

@ -127,11 +127,10 @@ this.log = function log()
* Selector string or DOMElement for the element(s) to wire up.
* @param object aDescriptor
* An object describing how to wire matching selector, supported properties
* are "events", "attributes" and "userData" taking objects themselves.
* Each key of properties above represents the name of the event, attribute
* or userData, with the value being a function used as an event handler,
* string to use as attribute value, or object to use as named userData
* respectively.
* are "events" and "attributes" taking objects themselves.
* Each key of properties above represents the name of the event or
* attribute, with the value being a function used as an event handler or
* string to use as attribute value.
* If aDescriptor is a function, the argument is equivalent to :
* {events: {'click': aDescriptor}}
*/
@ -157,7 +156,6 @@ this.wire = function wire(aRoot, aSelectorOrElement, aDescriptor)
element.addEventListener(aName, aHandler, false);
});
forEach(aDescriptor.attributes, element.setAttribute);
forEach(aDescriptor.userData, element.setUserData);
}
}