Replace trimLeft/trimRight functions (not supported by IE).

This commit is contained in:
Neil Fraser
2015-03-05 16:41:55 -06:00
parent adc1c5a381
commit 0d6a3bf99f

View File

@@ -216,8 +216,8 @@ Blockly.JavaScript['text_changeCase'] = function(block) {
Blockly.JavaScript['text_trim'] = function(block) {
// Trim spaces.
var OPERATORS = {
'LEFT': '.trimLeft()',
'RIGHT': '.trimRight()',
'LEFT': ".replace(/^[\\s\\xa0]+/, '')",
'RIGHT': ".replace(/[\\s\\xa0]+$/, '')",
'BOTH': '.trim()'
};
var operator = OPERATORS[block.getFieldValue('MODE')];