From c48eeb01bd726895dc577d8b843b2a75883eee07 Mon Sep 17 00:00:00 2001 From: Ananya Sen Date: Fri, 10 Feb 2012 16:03:52 -0800 Subject: Merge from /joseeight/ninja-internal/tree/FileIO Signed-off-by: Ananya Sen --- .../rich-text-editor.reel/rich-text-sanitizer.js | 132 +++++++++++++++++++++ 1 file changed, 132 insertions(+) create mode 100644 node_modules/labs/rich-text-editor.reel/rich-text-sanitizer.js (limited to 'node_modules/labs/rich-text-editor.reel/rich-text-sanitizer.js') diff --git a/node_modules/labs/rich-text-editor.reel/rich-text-sanitizer.js b/node_modules/labs/rich-text-editor.reel/rich-text-sanitizer.js new file mode 100644 index 00000000..3282d3e6 --- /dev/null +++ b/node_modules/labs/rich-text-editor.reel/rich-text-sanitizer.js @@ -0,0 +1,132 @@ +/* + This file contains proprietary software owned by Motorola Mobility, Inc.
+ No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.
+ (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. +
*/ +/** + @module "montage/ui/rich-text-sanitizer.js" + @requires montage/core/core +*/ +var Montage = require("montage").Montage; + +/** + @class module:"montage/ui/rich-text-sanitizer.js".Sanitizer + @extends module:montage/core/core.Montage +*/ +exports.Sanitizer = Montage.create(Montage,/** @lends module:"montage/ui/rich-text-sanitizer.js".Sanitizer# */ { + + willSetValue: { + value: function(value, identifier) { + return this._scopeCSS(value, identifier); + } + }, + + didGetValue: { + value: function(value, identifier) { + return this._unscopeCSS(value, identifier); + } + }, + + willInsertHTMLData: { + value: function(data, identifier) { + return this._scopeCSS(this._removeScript(data), identifier); + } + }, + + _scopeCSS: { + enumerable: true, + value: function(htmlFragment, identifier) { + var identifierSelector = ".editor-" + identifier+ " "; + + if (typeof htmlFragment == "string") { + // Extract the style tag and its content + htmlFragment = htmlFragment.replace(/(