タグ

ブックマーク / www.softel.co.jp (2)

  • 【Javascript】a要素のpathnameがIEとIE以外で違う at softelメモ

    If it has no leading “/” (U+002F) character, prepend a “/” (U+002F) character to the new value http://www.w3.org/TR/html5/urls.html#urls Uniform Resource Identifier (URI) http://tools.ietf.org/html/rfc3986 This attribute represents the path component of the Location’s URI which consists of everything after the host and port up to and excluding the first question mark (?) or hash mark (#). http://w

    【Javascript】a要素のpathnameがIEとIE以外で違う at softelメモ
    tyage
    tyage 2016/03/29
  • 【Javascript】 in演算子 at softelメモ

    問題 inって演算子なんですか。 答え in単体だと演算子です(for-inのはそういう”構文”)。 あまり見かけないけど、こういう書き方ができる。 Example if ("xxx" in obj) { //obj に xxx プロパティがあるとき //... } Example ("xxx" in obj) ? alert('obj.xxx あり') : alert('obj.xxx なし'); ただ、以下の書き方でだいたい事足りるので、あまり使われない。 if (obj.xxx) { //... } 「プロパティが存在するかどうか」と、「プロパティの値が真かどうか」という意味合いの違いはある。 /** * 準備 */ var o = {}; o.aaa = 123; o.bbb = null; o.ccc = undefined; /** * test 1 : プロパティがあって値が

    【Javascript】 in演算子 at softelメモ
  • 1