From 551301a7ac6b0825b75ffd5d042d382b6cb5e14f Mon Sep 17 00:00:00 2001 From: louyihua Date: Wed, 28 May 2014 23:44:50 +0800 Subject: [PATCH] Fix exception on Internet Explorer when adding first transcript language Internet Explorer throws an "Invalid argument" exception when uses an empty string as the parameter in ```namedItem``` method. Change empty string into null value can maintain browser consistency. --- cms/static/js/views/video/translations_editor.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cms/static/js/views/video/translations_editor.js b/cms/static/js/views/video/translations_editor.js index 75e2a01c39..e700b40fc6 100644 --- a/cms/static/js/views/video/translations_editor.js +++ b/cms/static/js/views/video/translations_editor.js @@ -47,6 +47,13 @@ function($, _, AbstractEditor, FileUpload, UploadDialog) { var dropdown = $(element).clone(); _.each(values, function(value, key) { + // Note: IE may raise an exception if key is an empty string, + // while other browsers return null as excepted. So coerce it + // into null for browser consistency. + if (key === "") { + key = null; + } + var option = dropdown[0].options.namedItem(key); if (option) {