/*
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(/(