是否可以访问css生成的内容:在规则之前?

Wil*_*ill 9 javascript css

我正在尝试使用html5和css计数器对文档中的数字进行编号.图编号css正在工作,但我需要能够生成包含图号的交叉引用.

有没有办法通过javascript访问这些值?我使用的计数器代码是:

body { counter-reset: section; }
section { counter-reset: figure;
          counter-increment: section; }
section section { counter-reset: section; }
section > h1:before { content: counters(section, '.'); }
.figure > .caption:before {
  counter-increment: figure;
  content: 'Figure ' counters(section, '.') '-' counter(figure); }
section > h1:before, .figure > .caption:before { margin-right: .5em; }
Run Code Online (Sandbox Code Playgroud)

cmp*_*ken 5

根据这篇文章:

生成的内容不会更改文档树.特别是,它不会反馈给文档语言处理器(例如,用于重新分析).

换句话说,似乎contentCSS属性只是在页面中添加了"样式"文本,而不会影响文档结构.DOM不知道这种样式,因此,Javascript无法访问它.