diff --git a/lib/helpers.js b/lib/helpers.js index 6f651ed..fbf3cdc 100644 --- a/lib/helpers.js +++ b/lib/helpers.js @@ -93,9 +93,9 @@ helpers.escape = function(text) { }); }; -helpers.parseTags = function(text) { +helpers.parseTags = function(text, screen) { return helpers.Element.prototype._parseTags.call( - { parseTags: true, screen: Screen.global }, text); + { parseTags: true, screen: screen || helpers.Screen.global }, text); }; helpers.generateTags = function(style, text) { @@ -150,6 +150,13 @@ helpers.dropUnicode = function(text) { .replace(unicode.chars.surrogate, '?'); }; +helpers.__defineGetter__('Screen', function() { + if (!helpers._screen) { + helpers._screen = require('./widgets/screen'); + } + return helpers._screen; +}); + helpers.__defineGetter__('Element', function() { if (!helpers._element) { helpers._element = require('./widgets/element');