DomParser in Lambda functions always not defined

I am trying out the Lambda Functions for an HTML transformation, and am using the DOMParser 
However I get 'DOMParser is not defined' as an error. i tried two options

a basic one with no success:
var htmlDoc = new DOMParser().parseFromString('','text/html');

and my code which throws same error:
var parser = new DOMParser();
var sourceData = $var.sample;
var htmlDoc = parser.parseFromString(sourceData, 'text/xml');

regardless of what I do, I get the not defined error. Any thoughts would be appreciated.
Other
2 replies