English 中文(简体)
传真5 固定持有人特征检测
原标题:HTML5 Placeholder feature detection woes

我需要测试对地主的支持。 现代浏览器以及IE7、IE8、IE9的运行情况如下:

$.support.placeholder = (function () {
    var i = document.createElement("input");
    return "placeholder" in i;
}());

它发挥了作用,但联合材料抱怨使用in:

Unexpected in . Compare with undefined, or use the hasOwnProperty method instead.

罚款,因此,我对此表示不满意:

$.support.placeholder = (function () {
    var i = document.createElement("input");
    return i.hasOwnProperty("placeholder");
}());

如今,这在JALint没有任何错误或警告的情况下通过,但IE7和IE8与这种老的营养相去:

目的不支持财产或方法 1. 所有权

如何使联合企业以及国际E7和IE8感到满意?

最佳回答

你们还可以利用其他解决办法共同行动建议:

return typeof i.placeholder !==  undefined ;

这应当毫无问题地跨越浏览器。

问题回答

我的回答不会。 Don t使人高兴。 共同提交文件是应如何使卡罗福德观点成为 Java。 它符合他的个人标准。 如果你想用某种灯 for,则使用。 JSHint。 它是一份完全可以想象的、没有cra要求的联合材料。 原文:

JSHint is a fork of JSLint, the tool written and maintained by Douglas Crockford.

The project originally started as an effort to make a more configurable version of JSLint—the one that doesn t enforce one particular coding style on its users—but then transformed into a separate static analysis tool with its own goals and ideals.

您可以通过<条码>目标.prototype查询功能,然后通过<条码>查询/代码>。 职能如下:。 您能够以<代码>i.hasOwnProperty-fashion(即this值>在座标有i:

Object.prototype.hasOwnProperty.call(i, "placeholder");




相关问题
CSS working only in Firefox

I am trying to create a search text-field like on the Apple website. The HTML looks like this: <div class="frm-search"> <div> <input class="btn" type="image" src="http://www....

image changed but appears the same in browser

I m writing a php script to crop an image. The script overwrites the old image with the new one, but when I reload the page (which is supposed to pickup the new image) I still see the old one. ...

Firefox background image horizontal centering oddity

I am building some basic HTML code for a CMS. One of the page-related options in the CMS is "background image" and "stretch page width / height to background image width / height." so that with large ...

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签