Skip to content
This repository has been archived by the owner on Dec 21, 2021. It is now read-only.

Commit

Permalink
AUI-692 - Build files
Browse files Browse the repository at this point in the history
  • Loading branch information
natecavanaugh committed Aug 11, 2012
1 parent 157cd28 commit c836f92
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 19 deletions.
46 changes: 37 additions & 9 deletions build/aui-parse-content/aui-parse-content-debug.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ var L = A.Lang,
PARSE_CONTENT = 'ParseContent',
QUEUE = 'queue',
SCRIPT = 'script',
SEMICOLON = ';',
SRC = 'src',

SCRIPT_TYPES = {
Expand Down Expand Up @@ -146,13 +147,34 @@ var ParseContent = A.Component.create(
*/
parseContent: function(content) {
var instance = this;

var output = instance._clean(content);

instance._dispatch(output);

return output;
},

/**
* Add inline script data to the queue.
*
* @method _addInlineScript
* @param {String} data The script content which should be added to the queue
* @protected
*/
_addInlineScript: function(data) {
var instance = this;

instance.get(QUEUE).add(
{
args: data,
context: instance,
fn: instance.globalEval,
timeout: 0
}
);
},

/**
* Bind listeners on the <code>insert</code> and <code>setContent</code>
* methods of the Node instance where you are plugging the ParseContent.
Expand Down Expand Up @@ -242,12 +264,21 @@ var ParseContent = A.Component.create(
*/
_dispatch: function(output) {
var instance = this;

var queue = instance.get(QUEUE);

var scriptContent = [];

output.js.each(function(node, i) {
var src = node.get(SRC);

if (src) {
if (scriptContent.length) {
instance._addInlineScript(scriptContent.join(SEMICOLON));

scriptContent.length = 0;
}

queue.add({
autoContinue: false,
fn: function () {
Expand All @@ -262,19 +293,16 @@ var ParseContent = A.Component.create(
});
}
else {
queue.add({
fn: function () {
var dom = node._node;
var dom = node._node;

instance.globalEval(
dom.text || dom.textContent || dom.innerHTML || ''
);
},
timeout: 0
});
scriptContent.push(dom.text || dom.textContent || dom.innerHTML || '');
}
});

if (scriptContent.length) {
instance._addInlineScript(scriptContent.join(SEMICOLON));
}

queue.run();
}
}
Expand Down
2 changes: 1 addition & 1 deletion build/aui-parse-content/aui-parse-content-min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

46 changes: 37 additions & 9 deletions build/aui-parse-content/aui-parse-content.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ var L = A.Lang,
PARSE_CONTENT = 'ParseContent',
QUEUE = 'queue',
SCRIPT = 'script',
SEMICOLON = ';',
SRC = 'src',

SCRIPT_TYPES = {
Expand Down Expand Up @@ -146,13 +147,34 @@ var ParseContent = A.Component.create(
*/
parseContent: function(content) {
var instance = this;

var output = instance._clean(content);

instance._dispatch(output);

return output;
},

/**
* Add inline script data to the queue.
*
* @method _addInlineScript
* @param {String} data The script content which should be added to the queue
* @protected
*/
_addInlineScript: function(data) {
var instance = this;

instance.get(QUEUE).add(
{
args: data,
context: instance,
fn: instance.globalEval,
timeout: 0
}
);
},

/**
* Bind listeners on the <code>insert</code> and <code>setContent</code>
* methods of the Node instance where you are plugging the ParseContent.
Expand Down Expand Up @@ -242,12 +264,21 @@ var ParseContent = A.Component.create(
*/
_dispatch: function(output) {
var instance = this;

var queue = instance.get(QUEUE);

var scriptContent = [];

output.js.each(function(node, i) {
var src = node.get(SRC);

if (src) {
if (scriptContent.length) {
instance._addInlineScript(scriptContent.join(SEMICOLON));

scriptContent.length = 0;
}

queue.add({
autoContinue: false,
fn: function () {
Expand All @@ -262,19 +293,16 @@ var ParseContent = A.Component.create(
});
}
else {
queue.add({
fn: function () {
var dom = node._node;
var dom = node._node;

instance.globalEval(
dom.text || dom.textContent || dom.innerHTML || ''
);
},
timeout: 0
});
scriptContent.push(dom.text || dom.textContent || dom.innerHTML || '');
}
});

if (scriptContent.length) {
instance._addInlineScript(scriptContent.join(SEMICOLON));
}

queue.run();
}
}
Expand Down

0 comments on commit c836f92

Please sign in to comment.