(function($) {
$.Arte = $.Arte || {};
$.Arte.dom = $.Arte.dom || {};
var dom = $.Arte.dom;
var configuration = $.Arte.configuration;
var constants = $.Arte.constants;
$.extend(dom, {
wrapWithOptions: function(jNodes, options) {
var wrapContainer = $();
if (jNodes.length > 0) {
wrapContainer = dom.createContainer(options);
var rangyStartTag = dom.prevSiblingIncludingTextNodes(jNodes.first());
if (rangyStartTag.hasClass(configuration.rangySelectionBoundaryClassName)) {
wrapContainer.append(rangyStartTag);
}
var rangyEndTag = dom.nextSiblingIncludingTextNodes(jNodes.last());
jNodes.first().before(wrapContainer);
jNodes.each(function() {
wrapContainer.append(this);
});
if (rangyEndTag.hasClass(configuration.rangySelectionBoundaryClassName)) {
wrapContainer.append(rangyEndTag);
}
}
return wrapContainer;
},
unwrapWithOptions: function(jNodes, options) {
var children = $();
jNodes.each(function() {
var $this = $(this);