V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
eliang
V2EX  ›  问与答

用纯 css 选择器的方式获取 github commit 的最后一格 block

  •  
  •   eliang · 2020-01-30 19:01:07 +08:00 · 1092 次点击
    这是一个创建于 1546 天前的主题,其中的信息可能已经有所发展或是发生改变。

    16ff61a0dab23f76 16ff61b4f5ed0324 16ff61bdce69aa05

    想问一下 我这里想获取最后一个方块

    document.querySelector('.js-calendar-graph-svg>g g:last-child rect:last-child')
    

    这么写感觉没有问题呀,可是为啥获取不到呢?

    1 条回复    2020-01-30 19:27:40 +08:00
    Mutoo
        1
    Mutoo  
       2020-01-30 19:27:40 +08:00   ❤️ 1
    document.querySelectorAll('g[transform]:last-of-type > rect:last-child')
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   5245 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 03:46 · PVG 11:46 · LAX 20:46 · JFK 23:46
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.