Dojo 使用 link 创建图像

Dojo create image with link

有没有办法使用 dojo/dom-construct 创建带有 link 的图像元素?我正在寻找等效于以下 HTML 代码:

<a href="test.html" target="_blank">
    <img src="/pix/byron_bay_225x169.jpg" >
</a>

是的,这是可能的!

就这样吧:

var anchor= domConstruct.create('a', {
    'href': 'test.html',
    'target': '_blank'
});
var image= domConstruct.create('img', {
     'src': '/pix/byron_bay_225x169.jpg'
});
domConstruct.place(image, anchor);

HTML:

<div data-dojo-attach-point="container"></div>

JS:

 var img = domConstruct.create("img", {
                 src: "/path/image.png",
                 style: "height:16px;width:16px;",
                 title: "Image",
                 onclick: function(){
                    // onclick event
                 },
                 onmouseenter: function(){
                    // on mouse over event
                 },
                 onmouseout: function(){
                    // on mouse out event
                 }
);
domConstruct.place(img, this.container);