sketchucation logo sketchucation
    • 登入
    Oops, your profile's looking a bit empty! To help us tailor your experience, please fill in key details like your SketchUp version, skill level, operating system, and more. Update and save your info on your profile page today!
    ⚠️ Important | Libfredo 15.6b introduces important bugfixes for Fredo's Extensions Update

    Multiple dialog scope issue on the PC

    已排程 已置頂 已鎖定 已移動 Developers' Forum
    24 貼文 4 Posters 708 瀏覽 4 Watching
    正在載入更多貼文
    • 從舊到新
    • 從新到舊
    • 最多點贊
    回覆
    • 在新貼文中回覆
    登入後回覆
    此主題已被刪除。只有擁有主題管理權限的使用者可以查看。
    • thomthomT 離線
      thomthom
      最後由 編輯

      Back tot the side topic of best practices:
      It's generally considered best practice to separate content, layout and behaviour. That means all CSS in a .css file and all JS in a .js file.

      And I've never heard of void(0) as best practice. I find it often in Bad Practices lists:
      http://www.quirksmode.org/blog/archives/2005/06/three_javascrip_1.html#link3

      Link Preview Image
      "javascript:void(0);" vs "return false" vs "preventDefault()"

      When I want some link to not do anything but only respond to JavaScript actions what is the best way to avoid the link scrolling to the top edge of the page? I know several ways of doing it, they all

      favicon

      Stack Overflow (stackoverflow.com)

      Thomas Thomassen — SketchUp Monkey & Coding addict
      List of my plugins and link to the CookieWare fund

      1 條回覆 最後回覆 回覆 引用 0
      • H 離線
        honkinberry
        最後由 編輯

        Both of those links that you sent merely say it is bad form to put javascript into the href, which is true.
        The javascript:void(0) is the recommended practice, indicating that the onclick handler is to take precedence.
        In fact, the whole point of it is so that it onclick handler doesn't have to return false.
        (See here: http://stackoverflow.com/questions/134845/href-attribute-for-javascript-links-or-javascriptvoid0)

        But good to know that was the issue!
        Many thanks for your tireless attention to detail on every conceivable issue.

        --J

        1 條回覆 最後回覆 回覆 引用 0
        • thomthomT 離線
          thomthom
          最後由 編輯

          @honkinberry said:

          Both of those links that you sent merely say it is bad form to put javascript into the href, which is true.
          The javascript:void(0) is the recommended practice, indicating that the onclick handler is to take precedence.
          In fact, the whole point of it is so that it onclick handler doesn't have to return false.
          (See here: http://stackoverflow.com/questions/134845/href-attribute-for-javascript-links-or-javascriptvoid0)

          But when would you use void(0) in anything other than the HREF?

          I still agree with with the this answer:
          http://stackoverflow.com/a/134957/486990

          There's a lot of information floating around which is lingering around from the older days. When going through best practices guides of well known web designers it's always to avoid inline JS. Which then removes void(0) from the equation completely.

          @honkinberry said:

          But good to know that was the issue!
          Many thanks for your tireless attention to detail on every conceivable issue.

          No worries. I had some spare time while I was rendering. 😄
          And the WebDialog has been a source of so much oddity that I felt a strong inclination to check it out myself. I reckon it's still worth reporting, so if you're heading into Boulder then give them a nudge. 😄

          Thomas Thomassen — SketchUp Monkey & Coding addict
          List of my plugins and link to the CookieWare fund

          1 條回覆 最後回覆 回覆 引用 0
          • Dan RathbunD 離線
            Dan Rathbun
            最後由 編輯

            @honkinberry said:

            The javascript:void(0) is the recommended practice, indicating that the onclick handler is to take precedence.

            I disagreed 3 years ago when we discussed this issue, and still do.

            Read my detailed explanation in this old thread: Webdialogs and Javascript void

            Any more discussion on this offtopic, can be done in that thread, if you wish.

            I'm not here much anymore.

            1 條回覆 最後回覆 回覆 引用 0
            • 1
            • 2
            • 2 / 2
            • 第一個貼文
              最後的貼文
            Buy SketchPlus
            Buy SUbD
            Buy WrapR
            Buy eBook
            Buy Modelur
            Buy Vertex Tools
            Buy SketchCuisine
            Buy FormFonts

            Advertisement