Skip to content

Commit 1d7cdbe

Browse files
committed
Editor: Fix incorrect usage of ID attributes on custom fields.
Repeated containers used for custom fields have duplicate ID attributes. Duplicate IDs are incorrect HTML, and will also cause unexpected results when trying to manipulate using JS. Duplicate IDs are changed to matching classes; CSS & JS updated to match. Props jankimoradiya, audrasjb, donmhico, afercia. Fixes #46964. git-svn-id: https://develop.svn.wordpress.org/trunk@47222 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 3fb063f commit 1d7cdbe

10 files changed

Lines changed: 50 additions & 50 deletions

File tree

src/js/_enqueues/admin/postbox.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,7 @@
421421
break;
422422
case 0:
423423
case 180:
424-
if ( $('#poststuff').length ) {
424+
if ( $( '.poststuff' ).length ) {
425425
this._pb_edit(1);
426426
} else {
427427
if ( !check.length || !check.is(':checked') )

src/wp-admin/css/dashboard.css

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
width: 49.5%;
77
}
88

9-
#wpbody-content #dashboard-widgets.columns-2 #postbox-container-2,
9+
#wpbody-content #dashboard-widgets.columns-2 .postbox-container-2,
1010
#wpbody-content #dashboard-widgets.columns-2 #postbox-container-3,
1111
#wpbody-content #dashboard-widgets.columns-2 #postbox-container-4 {
1212
float: right;
@@ -42,7 +42,7 @@
4242
width: 49.5%;
4343
}
4444

45-
.ie8 #wpbody-content #dashboard-widgets #postbox-container-2,
45+
.ie8 #wpbody-content #dashboard-widgets .postbox-container-2,
4646
.ie8 #wpbody-content #dashboard-widgets #postbox-container-3,
4747
.ie8 #wpbody-content #dashboard-widgets #postbox-container-4 {
4848
float: right;
@@ -1112,7 +1112,7 @@ a.rsswidget {
11121112
width: 49.5%;
11131113
}
11141114

1115-
#wpbody-content #dashboard-widgets #postbox-container-2,
1115+
#wpbody-content #dashboard-widgets .postbox-container-2,
11161116
#wpbody-content #dashboard-widgets #postbox-container-3,
11171117
#wpbody-content #dashboard-widgets #postbox-container-4 {
11181118
float: right;

src/wp-admin/css/edit.css

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
#poststuff {
1+
.poststuff {
22
padding-top: 10px;
33
min-width: 763px;
44
}
55

6-
#poststuff #post-body {
6+
.poststuff #post-body {
77
padding: 0;
88
}
99

10-
#poststuff .postbox-container {
10+
.poststuff .postbox-container {
1111
width: 100%;
1212
}
1313

14-
#poststuff #post-body.columns-2 {
14+
.poststuff #post-body.columns-2 {
1515
margin-right: 300px;
1616
}
1717

@@ -51,7 +51,7 @@
5151
margin: 0;
5252
}
5353

54-
#poststuff #titlewrap {
54+
.poststuff #titlewrap {
5555
border: 0;
5656
padding: 0;
5757
}
@@ -414,7 +414,7 @@ form#tags-filter {
414414
padding-top: 20px;
415415
}
416416

417-
#poststuff #post-body.columns-2 #side-sortables {
417+
.poststuff #post-body.columns-2 #side-sortables {
418418
width: 280px;
419419
}
420420

@@ -596,34 +596,34 @@ form#tags-filter {
596596
text-indent: 0;
597597
}
598598

599-
#poststuff h3.hndle, /* Back-compat for pre-4.4 */
600-
#poststuff .stuffbox > h3, /* Back-compat for pre-4.4 */
601-
#poststuff h2 {
599+
.poststuff h3.hndle, /* Back-compat for pre-4.4 */
600+
.poststuff .stuffbox > h3, /* Back-compat for pre-4.4 */
601+
.poststuff h2 {
602602
font-size: 14px;
603603
padding: 8px 12px;
604604
margin: 0;
605605
line-height: 1.4;
606606
}
607607

608-
#poststuff .stuffbox h2 {
608+
.poststuff .stuffbox h2 {
609609
padding: 8px 10px;
610610
}
611611

612-
#poststuff .inside {
612+
.poststuff .inside {
613613
margin: 6px 0 0 0;
614614
}
615615

616-
#poststuff .stuffbox .inside {
616+
.poststuff .stuffbox .inside {
617617
margin: 0;
618618
}
619619

620-
#poststuff .inside #parent_id,
621-
#poststuff .inside #page_template {
620+
.poststuff .inside #parent_id,
621+
.poststuff .inside #page_template {
622622
max-width: 100%;
623623
}
624624

625-
.ie8 #poststuff .inside #parent_id,
626-
.ie8 #poststuff .inside #page_template {
625+
.ie8 .poststuff .inside #parent_id,
626+
.ie8 .poststuff .inside #page_template {
627627
width: 250px;
628628
}
629629

@@ -642,7 +642,7 @@ form#tags-filter {
642642
}
643643

644644
#linksubmitdiv .inside, /* Old Link Manager back-compat. */
645-
#poststuff #submitdiv .inside {
645+
.poststuff #submitdiv .inside {
646646
margin: 0;
647647
padding: 0;
648648
}
@@ -1091,11 +1091,11 @@ p.description code {
10911091
13.0 - Tags
10921092
------------------------------------------------------------------------------*/
10931093

1094-
#poststuff .tagsdiv .ajaxtag {
1094+
.poststuff .tagsdiv .ajaxtag {
10951095
margin-top: 1em;
10961096
}
10971097

1098-
#poststuff .tagsdiv .howto {
1098+
.poststuff .tagsdiv .howto {
10991099
margin: 1em 0 6px 0;
11001100
}
11011101

@@ -1140,7 +1140,7 @@ p.popular-tags a {
11401140
margin: 2px 0 12px;
11411141
}
11421142

1143-
#poststuff .inside .the-tagcloud {
1143+
.poststuff .inside .the-tagcloud {
11441144
margin: 5px 0 10px;
11451145
padding: 8px;
11461146
border: 1px solid #ddd;
@@ -1412,11 +1412,11 @@ table.links-table {
14121412

14131413
/* one column on the post write/edit screen */
14141414
@media only screen and (max-width: 850px) {
1415-
#poststuff {
1415+
.poststuff {
14161416
min-width: 0;
14171417
}
14181418

1419-
#wpbody-content #poststuff #post-body {
1419+
#wpbody-content .poststuff #post-body {
14201420
margin: 0;
14211421
}
14221422

@@ -1425,14 +1425,14 @@ table.links-table {
14251425
width: 100%;
14261426
}
14271427

1428-
#poststuff #postbox-container-1 .empty-container,
1429-
#poststuff #postbox-container-1 #side-sortables:empty {
1428+
.poststuff #postbox-container-1 .empty-container,
1429+
.poststuff #postbox-container-1 #side-sortables:empty {
14301430
border: 0 none;
14311431
height: 0;
14321432
min-height: 0;
14331433
}
14341434

1435-
#poststuff #post-body.columns-2 #side-sortables {
1435+
.poststuff #post-body.columns-2 #side-sortables {
14361436
min-height: 0;
14371437
width: auto;
14381438
}
@@ -1457,13 +1457,13 @@ table.links-table {
14571457
padding: 10px 10px;
14581458
}
14591459

1460-
#poststuff .stuffbox .inside {
1460+
.poststuff .stuffbox .inside {
14611461
padding: 0 2px 4px 0;
14621462
}
14631463

1464-
#poststuff h3.hndle, /* Back-compat for pre-4.4 */
1465-
#poststuff .stuffbox > h3, /* Back-compat for pre-4.4 */
1466-
#poststuff h2 {
1464+
.poststuff h3.hndle, /* Back-compat for pre-4.4 */
1465+
.poststuff .stuffbox > h3, /* Back-compat for pre-4.4 */
1466+
.poststuff h2 {
14671467
padding: 12px;
14681468
}
14691469

src/wp-admin/css/ie.css

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
width: 49.5%;
1414
}
1515

16-
#wpbody-content #dashboard-widgets #postbox-container-2,
16+
#wpbody-content #dashboard-widgets .postbox-container-2,
1717
#wpbody-content #dashboard-widgets #postbox-container-3,
1818
#wpbody-content #dashboard-widgets #postbox-container-4 {
1919
float: right;
@@ -367,7 +367,7 @@ a.button.button-small {
367367
#wrap,
368368
#postdivrich,
369369
#postdiv,
370-
#poststuff,
370+
.poststuff,
371371
.metabox-holder,
372372
#titlediv,
373373
#post-body,
@@ -414,12 +414,12 @@ form#template div {
414414
padding: 0 4px;
415415
}
416416

417-
#poststuff h2 {
417+
.poststuff h2 {
418418
font-size: 1.6em;
419419
}
420420

421-
#poststuff .inside #parent_id,
422-
#poststuff .inside #page_template,
421+
.poststuff .inside #parent_id,
422+
.poststuff .inside #page_template,
423423
.inline-edit-row #post_parent,
424424
.inline-edit-row select[name="page_template"] {
425425
width: 250px;
@@ -677,7 +677,7 @@ input[type="password"],
677677
padding: 0;
678678
}
679679

680-
* html #poststuff h2 {
680+
* html .poststuff h2 {
681681
margin-left: 0;
682682
}
683683

src/wp-admin/css/media.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1033,15 +1033,15 @@ border color while dragging a file over the uploader drop area */
10331033
display: block;
10341034
}
10351035

1036-
#poststuff .imgedit-group-top h2 {
1036+
.poststuff .imgedit-group-top h2 {
10371037
display: inline-block;
10381038
margin: 0;
10391039
padding: 0;
10401040
font-size: 14px;
10411041
line-height: 1.4;
10421042
}
10431043

1044-
#poststuff .imgedit-group-top .button-link {
1044+
.poststuff .imgedit-group-top .button-link {
10451045
text-decoration: none;
10461046
color: #23282d;
10471047
}

src/wp-admin/edit-form-advanced.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -494,7 +494,7 @@
494494
do_action( 'edit_form_top', $post );
495495
?>
496496

497-
<div id="poststuff">
497+
<div class="poststuff">
498498
<div id="post-body" class="metabox-holder columns-<?php echo 1 == get_current_screen()->get_columns() ? '1' : '2'; ?>">
499499
<div id="post-body-content">
500500

@@ -671,7 +671,7 @@
671671

672672
?>
673673
</div>
674-
<div id="postbox-container-2" class="postbox-container">
674+
<div class="postbox-container-2 postbox-container">
675675
<?php
676676

677677
do_meta_boxes( null, 'normal', $post );

src/wp-admin/edit-form-comment.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
<div class="wrap">
1717
<h1><?php _e( 'Edit Comment' ); ?></h1>
1818

19-
<div id="poststuff">
19+
<div class="poststuff">
2020
<input type="hidden" name="action" value="editedcomment" />
2121
<input type="hidden" name="comment_ID" value="<?php echo esc_attr( $comment->comment_ID ); ?>" />
2222
<input type="hidden" name="comment_post_ID" value="<?php echo esc_attr( $comment->comment_post_ID ); ?>" />
@@ -196,7 +196,7 @@
196196
</div><!-- /submitdiv -->
197197
</div>
198198

199-
<div id="postbox-container-2" class="postbox-container">
199+
<div class="postbox-container-2 postbox-container">
200200
<?php
201201
/** This action is documented in wp-admin/includes/meta-boxes.php */
202202
do_action( 'add_meta_boxes', 'comment', $comment );

src/wp-admin/edit-link-form.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@
106106
wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false );
107107
?>
108108

109-
<div id="poststuff">
109+
<div class="poststuff">
110110

111111
<div id="post-body" class="metabox-holder columns-<?php echo 1 == get_current_screen()->get_columns() ? '1' : '2'; ?>">
112112
<div id="post-body-content">
@@ -144,7 +144,7 @@
144144

145145
?>
146146
</div>
147-
<div id="postbox-container-2" class="postbox-container">
147+
<div class="postbox-container-2 postbox-container">
148148
<?php
149149

150150
do_meta_boxes( null, 'normal', $link );

src/wp-admin/includes/dashboard.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ function wp_dashboard() {
245245
<div id="postbox-container-1" class="postbox-container">
246246
<?php do_meta_boxes( $screen->id, 'normal', '' ); ?>
247247
</div>
248-
<div id="postbox-container-2" class="postbox-container">
248+
<div class="postbox-container-2 postbox-container">
249249
<?php do_meta_boxes( $screen->id, 'side', '' ); ?>
250250
</div>
251251
<div id="postbox-container-3" class="postbox-container">

src/wp-admin/includes/post.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2271,8 +2271,8 @@ function the_block_editor_meta_boxes() {
22712271
</form>
22722272
<?php foreach ( $locations as $location ) : ?>
22732273
<form class="metabox-location-<?php echo esc_attr( $location ); ?>" onsubmit="return false;">
2274-
<div id="poststuff" class="sidebar-open">
2275-
<div id="postbox-container-2" class="postbox-container">
2274+
<div class="poststuff" class="sidebar-open">
2275+
<div class="postbox-container-2 postbox-container">
22762276
<?php
22772277
do_meta_boxes(
22782278
$current_screen,

0 commit comments

Comments
 (0)