Page MenuHomePhabricator

specific id or class for the first <p> of an article
Closed, DeclinedPublic

Description

Author: alistrius

Description:
Like <h1 class="firstHeading">, a <p class="firstParagraph"> should be really useful for javascript catchers. When there are diambiguations links or pictures between the first heading and the first paragraph, the javascript for catch the first paragraph becomes very tricky, and a simple class or id could make it more simple.

Furthermore, because the first paragraph have a special status in a wikipedia page (bounds the #toc, defines the subject, includes the infobox, etc.) a DOM identifer could help in many other cases.


Version: unspecified
Severity: enhancement

Details

Reference
bz10588

Event Timeline

bzimport raised the priority of this task from to Lowest.Nov 21 2014, 9:51 PM
bzimport added a project: MediaWiki-Parser.
bzimport set Reference to bz10588.
bzimport added a subscriber: Unknown Object (MLST).

alistrius wrote:

i set the priority high beause this problem stops me in a javascript i'm coding. I don't know exactly how priority grading system works, so feel free to change it.

ayg wrote:

The first <p> is exactly that, the first <p>. JavaScript can trivially be written to retrieve it, for instance (not tested but you get the idea):

element = document.getElementById( 'bodyContent' ).firstChild;
while( true ) {
if( element.nodeType == 1 && element.nodeName == 'p' ) break;
else element = element.nextSibling();
}

This looks like an extremely narrow request that would be of use to very few.