setAttribute使属性名称小写

Bri*_*anM 5 html javascript forms dom typescript

我使用创建元素,var l = document.createElement("label");并使用分配其属性l.setAttribute("formControlName","e");。问题在于setAttribute方法将formControlName转换为小写字母,如下图所示。我与ionic一起工作,因此需要使用大写字母。有人看到我做错了吗?

在此处输入图片说明

在此处输入图片说明

Chi*_*idi 8

使用此代替:

l.setAttributeNS(null, "formControlName","e");
Run Code Online (Sandbox Code Playgroud)

'setAttributeNS()'不会将名称转换为小写。