Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge jQuery 1.7.2 .attr() fix from TinyMCE 3.5

  • Loading branch information...
commit 902836712f22b60be2b1b8fcd934690d19b20dcd 1 parent 74f47b1
@andrerom andrerom authored
Showing with 22 additions and 17 deletions.
  1. +22 −17 design/standard/javascript/classes/adapter/jquery/jquery.tinymce.js
View
39 design/standard/javascript/classes/adapter/jquery/jquery.tinymce.js
@@ -1,15 +1,15 @@
/**
* jquery.tinymce.js
*
- * Copyright 2009, Moxiecode Systems AB
+ * Copyright, Moxiecode Systems AB
* Released under LGPL License.
*
- * License: http://tinymce.moxiecode.com/license
- * Contributing: http://tinymce.moxiecode.com/contributing
+ * License: http://www.tinymce.com/license
+ * Contributing: http://www.tinymce.com/contributing
*/
(function($) {
- var undefined,
+ var undef,
lazyLoading,
delayedInits = [],
win = window;
@@ -79,7 +79,7 @@
}
// Load TinyMCE on demand, if we need to
- if (!win["tinymce"] && !lazyLoading && (url = settings.script_url)) {
+ if (!win.tinymce && !lazyLoading && (url = settings.script_url)) {
lazyLoading = 1;
base = url.substring(0, url.lastIndexOf("/"));
@@ -108,7 +108,7 @@
url = url + (/\?/.test(url) ? '&' : '?') + "js=true&core=true&suffix=" + escape(suffix) + "&themes=" + escape(settings.theme) + "&plugins=" + escape(settings.plugins) + "&languages=" + lang;
// Check if compressor script is already loaded otherwise setup a basic one
- if (!win["tinyMCE_GZ"]) {
+ if (!win.tinyMCE_GZ) {
tinyMCE_GZ = {
start : function() {
tinymce.suffix = suffix;
@@ -209,7 +209,7 @@
var self = this, ed;
// Handle set value
- if (value !== undefined) {
+ if (value !== undef) {
removeEditors.call(self);
// Saves the contents before get/set value of textarea/div
@@ -230,14 +230,14 @@
function tinyMCEInstance(element) {
var ed = null;
- (element) && (element.id) && (win["tinymce"]) && (ed = tinyMCE.get(element.id));
+ (element) && (element.id) && (win.tinymce) && (ed = tinyMCE.get(element.id));
return ed;
}
// Checks if the specified set contains tinymce instances
function containsTinyMCE(matchedSet) {
- return !!((matchedSet) && (matchedSet.length) && (win["tinymce"]) && (matchedSet.is(":tinymce")));
+ return !!((matchedSet) && (matchedSet.length) && (win.tinymce) && (matchedSet.is(":tinymce")));
}
// Patch various jQuery functions
@@ -256,7 +256,7 @@
if (!containsTinyMCE(self))
return origFn.apply(self, arguments);
- if (value !== undefined) {
+ if (value !== undef) {
loadOrSave.call(self.filter(":tinymce"), value);
origFn.apply(self.not(":tinymce"), arguments);
@@ -287,7 +287,7 @@
if (!containsTinyMCE(self))
return origFn.apply(self, arguments);
- if (value !== undefined) {
+ if (value !== undef) {
self.filter(":tinymce").each(function(i, node) {
var ed = tinyMCEInstance(node);
@@ -315,21 +315,26 @@
jQueryFn.attr = $.fn.attr;
// Makes sure that $('#tinymce_id').attr('value') gets the editors current HTML contents
- $.fn.attr = function(name, value, type) {
+ $.fn.attr = function(name, value) {
var self = this;
- if ((!name) || (name !== "value") || (!containsTinyMCE(self)))
- return jQueryFn.attr.call(self, name, value, type);
+ if ((!name) || (name !== "value") || (!containsTinyMCE(self))) {
+ if (value !== undef) {
+ return jQueryFn.attr.call(self, name, value);
+ } else {
+ return jQueryFn.attr.call(self, name);
+ }
+ }
- if (value !== undefined) {
+ if (value !== undef) {
loadOrSave.call(self.filter(":tinymce"), value);
- jQueryFn.attr.call(self.not(":tinymce"), name, value, type);
+ jQueryFn.attr.call(self.not(":tinymce"), name, value);
return self; // return original set for chaining
} else {
var node = self[0], ed = tinyMCEInstance(node);
- return ed ? ed.getContent() : jQueryFn.attr.call($(node), name, value, type);
+ return ed ? ed.getContent() : jQueryFn.attr.call($(node), name, value);
}
};
}
Please sign in to comment.
Something went wrong with that request. Please try again.