在这种情况下,“Scry”意味着“找到所有”。见this comment on ReactTestUtils.scryRenderedComponentsWithClass
.这是一个单词,而不是缩写,它的发音如“cry”,但在开头有一个“s”。
更长(和nerdier)答案
在同一个文件的其他地方,你会看到a reference to DOM.scry
:
/** * Todo: Support the entire DOM.scry query Syntax. For now,these simple * utilities will suffice for testing purposes. * @lends ReactTestUtils */
zpao在a comment on a GitHub issue年解释说:
That’s a reference to an internal Facebook module. It’s basically
querySelectorAll
with fallback behavior for handling old browsers and special cases. It is pretty unremarkable and doesn’t actually translate super well here (except maybe ascryRenderedDOMComponentsWithQSA
or something,but meh). We’re working on improving the testing in other ways so I don’t think there’s anything we really want to do with this right now.
jimfb在another GitHub issue进一步说明,该名称是对“地下城与地下城”的引用。龙:
Back in the day,we had a bunch of D&D fans on the team.
For reference:
07004
07005
07006Historically,we’ve used scry to indicate a helper that finds a set of results. As the framework matures,we should start choosing function names based on what the functions actually do instead of fantasy words that have very little meaning to the typical developer.
虽然我同意这个词在很大程度上没有意义,但值得注意的是“scry” is a real English word:
scry
[skrahy]verb (used without object),scried,scrying.
- to use divination to discover hidden knowledge or future events,especially by means of a crystal ball.
有趣的是,根据the data from Google’s Ngram Viewer年,似乎这个词在19世纪初被普遍使用,直到20世纪80年代才被忽略,可能在D&D得到普及之后:
所以我不能说我反对把jimfb称之为“幻想词”,特别是考虑到我听到这种想象的想象。