X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/3f5685912e89eb3b0534acd85aa0946b1ca2bbe3..refs/tags/wordpress-3.7:/wp-includes/js/tinymce/utils/form_utils.js?ver=327-1235 diff --git a/wp-includes/js/tinymce/utils/form_utils.js b/wp-includes/js/tinymce/utils/form_utils.js index f6cd96a0..6f62fe60 100644 --- a/wp-includes/js/tinymce/utils/form_utils.js +++ b/wp-includes/js/tinymce/utils/form_utils.js @@ -1,19 +1,24 @@ /** - * $Id: form_utils.js 1184 2009-08-11 11:47:27Z spocke $ + * form_utils.js * - * Various form utilitiy functions. + * Copyright 2009, Moxiecode Systems AB + * Released under LGPL License. * - * @author Moxiecode - * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved. + * License: http://tinymce.moxiecode.com/license + * Contributing: http://tinymce.moxiecode.com/contributing */ var themeBaseURL = tinyMCEPopup.editor.baseURI.toAbsolute('themes/' + tinyMCEPopup.getParam("theme")); function getColorPickerHTML(id, target_form_element) { - var h = ""; + var h = "", dom = tinyMCEPopup.dom; - h += ''; - h += ' '; + if (label = dom.select('label[for=' + target_form_element + ']')[0]) { + label.id = label.id || dom.uniqueId(); + } + + h += ''; + h += ' '; return h; } @@ -66,6 +71,9 @@ function selectByValue(form_obj, field_name, value, add_custom, ignore_case) { if (!form_obj || !form_obj.elements[field_name]) return; + if (!value) + value = ""; + var sel = form_obj.elements[field_name]; var found = false; @@ -170,7 +178,7 @@ function convertHexToRGB(col) { } function trimSize(size) { - return size.replace(/([0-9\.]+)px|(%|in|cm|mm|em|ex|pt|pc)/, '$1$2'); + return size.replace(/([0-9\.]+)(px|%|in|cm|mm|em|ex|pt|pc)/i, '$1$2'); } function getCSSSize(size) { @@ -182,6 +190,9 @@ function getCSSSize(size) { // Add px if (/^[0-9]+$/.test(size)) size += 'px'; + // Sanity check, IE doesn't like broken values + else if (!(/^[0-9\.]+(px|%|in|cm|mm|em|ex|pt|pc)$/i.test(size))) + return ""; return size; }