Revision: 37101
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at December 3, 2010 23:03 by burnandbass
Initial Code
public static function close_dangling_tags(str:String):String { var open_tags:Array = str.match(/<[a-z]+( .*)?(?!\/)>/img).map(function(e:*,i:int,arr:Array):String{return e.substr(1,e.length-2) }); var closed_tags:Array = str.match(/<\/[a-z]+>/img).map(function(e:*,i:int,arr:Array):String{return e.substr(1,e.length-2) }); if (open_tags.length == closed_tags.length){ return str; } var tag_heap:Array = new Array(); for each(var tag:String in open_tags) { tag_heap.push(tag); while (tag_heap.length && closed_tags.length && ArrayTools.last(tag_heap) == ArrayTools.first(closed_tags)) { tag_heap.pop(); closed_tags.shift(); } } return str+tag_heap.reverse().map(function(e:*,i:int,arr:Array):String{return '</'+e+'>'}).join(''); }
Initial URL
Initial Description
Sometimes you need to tween htmlText with Tweener and Text Shortcuts :)
Initial Title
Close htmlText tag function - usefull if you tween htmlText
Initial Tags
Initial Language
ActionScript 3